Knowledge Base
Searching in : Document
ID: DT08U00298
Version: NoMachine 9
Added on: 2025-05-20
Last Update: 2025-12-31
Print this article

Collect server side logs automatically

Introduction

Since v9, there is a new function in the NoMachine User Interface (UI) to collect logs from the server host and all nodes. This can be done via the UI on the server host or via the remote administration UI launched by the client and connected to the remote server. Function to collect logs will enable create a .zip log archive that can be then sent to the Support Team. It's possible to specify where the archive must be created and how it has to be named. There is also the possibility to monitor the progressive creation of the log archive.

The possibility to collect logs via server's command line tools still remains. Commands are to enable debug log level, collect the necessary logs and create a compressed archive ready to be sent to the Support Team. These tools are run by the 'nxserver --debug' and relative options.

The 'nxserver --debug' commands used in the instructions from command line have to be executed in a terminal on Linux and macOS or a CMD console on Windows.

Administrative privileges are requested to run it: launch it with sudo on Linux and macOS or without sudo and as root; on Windows open a CMD console executed as administrator.

Client side logs
About client side logs, when the connection terminates with an error, the client shows a short error message and asks to save logs of that problem into a directory.
Otherwise, if requested by the Support Team, you can use the UI facilities to gather client logs while the session is running or collect them manually as explained in the next paragraphs.

Multi-host environment
In case of multi-host environments, it's possible to collect logs via UI from the problematic node.

If the command line is used instead, the 'nxserver --debug' tools must be run on the main server and on the problematic host where the issue occurred. For example, in a multi-node environment made of a main server ETS and two nodes ETSN1 and ETSN2, if the session cannot be started on the second node it will be necessary to run the 'nxserver --debug' commands on ETS and also on ETSN2 to gather logs from both machines. In a similar way, in case of a Cloud Server set-up, it's necessary to collect logs from the Cloud Server and from the node where the problem occurs.

Logging to syslog
The User Interface and the 'nxserver --debug' tools cannot be used to collect logs written to system log.
When server and/or node and/or web player are configured to log to the system log, it's necessary to collect manually the nx* log entries. For example on Linux, retrieve logs from journalctl or from syslog:

journalctl -b -0 | grep -i "nxserver\|nxnode\|nxwebplayer" > journalctl.extract
or:
grep "nxserver\|nxnode\|nxwebplayer" /var/log/SYSLOGFILE > syslog.extract
where SYSLOGFILE is the system log file.

In case of sudden termination of nx* processes, it's still necessary to retrieve the related core file and debug it as explained in the chapter about How to Gather a Stacktrace in the guide for collecting logs manually in the 'Configuration' section at: https://www.nomachine.com/all-documents

Collect NoMachine Logs

1. Gather Logs via UI


It's possible to collect server and client logs via User Interface.

1.1. Server Logs

Collect server logs

Step 1 - Open the UI on the server host -> Settings -> Server -> Security

Step 2 - Scroll down the Security panel till the end to find section 'Server logs'. Set there the log level as requested by the Support Team. Restarting the server is requested to make change effective, this will terminate all sessions. If this is not an option, use the manual procedure from command line.

Step 3 - Reproduce the problem.

If client logs are also requested, open the UI on the user's computer -> Player Settings -> Security and check option 'Don't delete log files on exit'. Connect and reproduce the problem.

Step 4 - Click on the 'Take logs' button: you will be requested to provide username and password of the administrator. Logs will be saved in a .zip archive.

Step 4.1 - If requested, collect also client side logs (see section below).

Step 5 - Choose where to save the log archive, by default it's on the desktop. You can also provide a different name for the log archive.

Step 6 - Retrieve the log archive and send it to the Support Team as requested.

Step 7 - Restore log level 6- Standard to avoid verbose logs. Restarting the server is requested to make change effective.

In case of multinode environments, you can collect the logs also from the affected node in the same way.

1.2. Client Logs

Collect client logs

In case of a connection error, save the logs from the error dialog.

If it's necessary to retrieve logs of a session up and running, when the problem
has been reproduced, open the menu panel (ctrl+alt+0 or click on the page peel in the
top right corner of the window) -> Connection and click on 'Take the logs'.

If a complete set of logs is requested, follow instructions below. Logs above will be included.

Step 1 - Open the NoMachine UI on the computer of the affected user and enter Player Settings -> Security.

Step 2 - In the 'Player logs' section, click on button 'Take logs'.

This will compress the .nx directory, by default placed in the home of the user who opened the client and produce a log archive in .zip format.

Step 3 - Choose where to save the log archive, by default it's on the desktop. You can also provide a different name for the log archive.

Step 4 - Send the log archive to the Support Team.

1.3. Services Logs

Export a service log

Step 1 - Open the UI-> Settings -> Server -> Ports panel.

Step 2 - Highlight the service, for example 'NX' and click on Configure.

Step 3 - In the next panel click on Export. Log will be saved in a .txt format reporting the service name, date and time, for example: nxd, 2024-10-11 16.30.15.log

Step 4 - Send the log to the Support Team.

2. Gather Logs from Command Line


Command 'nxserver --debug --enable' allows to gather debug logs for all components: nxserver, nxnode, nxwebplayer/runner and the display agent. Execute it on the server/node machine where the problem occurs.

This command edits the server.cfg file and sets:
SessionLogLevel 7
WebSessionLogLevel 7

It also edits node.cfg and sets:
SessionLogLevel 7
SessionLogClean 0

NoMachine server and services are not restarted. Old sessions continue to run. The debug settings will apply only to new sessions.

First Step: Enable Debug Level on the Problematic Server/Node Host

Linux and macOS

$ sudo /etc/NX/nxserver --debug --enable all

If you are the root user, run the command above without 'sudo'.

Windows

To enable debug on Windows, open a CMD console as administrator and execute:

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --debug --enable all

Depending on the problem, it could be useful to enable debug for a specific target only. This is in general specified by the Support Team when needed. Multiple targets can be specified in a comma-separated list:

nxserver --debug --enable server,node
nxserver --debug --enable webplayer
nxserver --debug --enable agent

Second Step: Connect and Reproduce the Problem

The debug level applies to new sessions only: create a new session and try to reproduce the problem.

Third Step: Create the Log Archive on the Server/Node Host

Once the problem is reproduced, collect logs and generate the log archive to be sent to the Support Team.

Linux

$ sudo /etc/NX/nxserver --debug --collect  /usr/NX/var/log/archives/NoMachine-log.zip

If you are the root user, run the command above without 'sudo'.

/usr/NX/var/log/archives/NoMachine-log.zip is the suggested path and filename for the log archive, you can change it. If only the name is specified, the archive is created in the current directory where the command is executed.

macOS

$ sudo /etc/NX/nxserver --debug --collect  /Library/Application\ Support/NoMachine/var/log/archives/NoMachine-log.zip

/Library/Application\ Support/NoMachine/var/log/archives/NoMachine-log.zip is the suggested path and filename for the log archive, you can change it. If only the name is specified, the archive is created in the current directory where the command is executed.

Windows

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --debug --collect %PROGRAMDATA%\NoMachine\var/log\archives\NoMachine-log.zip 

%PROGRAMDATA%\NoMachine\var/log\archives\NoMachine-log.zip is the suggested path and filename for the log archive, you can change it. If only the name is specified, the archive is created in the current directory where the command is executed.

Fourth Step: Collect Client Side Logs (if requested)

The following instructions have to be done to the user's device.

Open the UI -> Player Settings -> Security and check option 'Don't delete log files on exit'. Connect and reproduce the problem. Otherwise, don't close the client before collecting logs.

Then collect logs manually: create a compressed archive of the .nx directory in the user's home.

Linux

$ sudo tar -cvp --exclude 'cache*' --exclude 'images' --exclude 'temp' -f - path_to_user_home/.nx | gzip -c nxdir.tar.

If you are the owner of the user's home, execute command above without 'sudo'.

When the users' home directories are NFS mounted and the squash_root option is set in NFS, add the "-u $user" to command:

$ sudo -u USERNAME tar -cvp --exclude 'cache*' --exclude 'images' --exclude 'temp' -f - path_to_user_home/.nx | gzip -c nxdir.tar.gz

macOS

On macOS, navigate with the Finder till the .nx directory. To reduce the size of the archive, remove cache, images and recording sub-directories under .nx before creating the compressed folder.

Compress this folder: control-click or right-click the folder and then choose 'Create Archive' from the pop-up menu.

Windows

On Windows the .nx folder is hidden. To find it, write the following in the address bar or the file browser:

%USERPROFILE%\.nx

Otherwise navigate through the computer folder till the user's home and digit .nx in the navigation toolbar to reach it. Path can be similar to: C:/Users/nomachine/.nx

To reduce the size of the archive, remove cache, images and recording sub-directories under .nx before creating the compressed folder.

Fifth Step: Send Logs to Support Team

Send via e-mail to the Support Team (as e-mail attachment):
a) the NoMachine-log archive from the server side
b) the compressed .nx directory from the user's home on his/her computer (if requested)

Please be sure to include ID of the enquiry in the subject of your e-mail to Support Team!

If the size of the log archive doesn't allow to send it by email, inform the Support Team who will provide an upload space for that.

Sixth Step: Restore Informational Level (Disable Debug Level) on the Server/Node Host

Once logs have been retrieved, it's advisable to restore the Informational Log level to reduce the size of logs that will be printed.

Linux and Mac

$ sudo /etc/NX/nxserver --debug --disable all

Windows

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --debug --disable all

3. Collect Specific Logs by Running a Custom Script


The 'nxserver --debug --collect' procedure allows also to run custom scripts for including the output of specific command (e.g. run nxserver --list, --history, --nodelist etc ...).

Place the custom debug script in the NoMachine installation dir/scripts/log/ directory and follow the same procedure described in the paragraph above.

The 'nxserver --debug --collect' procedure will set correct permissions to the custom script and execute it before collecting logs as usual.

4. How to Clean-Up Logs


It's possible to clean up log files on the server/node host before proceeding to set debug level, reproduce the problem and collect the logs. This will help to reduce the size of logs and focus on the problem (if easily reproducible).

4.1. Clean-up All Logs

To do that, force the rotation of NoMachine logs by executing the 'nxserver --logrotate' command.

Linux and macOS

Open a terminal and run:

$ sudo /etc/NX/nxserver --logrotate


Windows

Open a CMD console as administrator and execute:

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --logrotate

Rotated files are compressed .gz archives. They are saved in the NoMachine var/log/logrotate directory.
On Linux: /usr/NX/var/log/logrotate
On macOS: /Library/Application Support/NoMachine/var/log/logrotate
On Windows: %PROGRAMDATA%\NoMachine\var\log\logrotate

They are named like:
nx.log-user-timestamp.gz for log archive from user's home/.nx nx.log-timestamp for log archive from NoMachine's var/log/.

The output of the 'nxserver --logrotate' command indicates name and place of the
archives, for example:

NX> 900 Created compressed file '/Library/Application Support/NoMachine/var/log/logrotate/nxserver.log-2023.07.17-16.02.52.gz'.
NX> 900 Created compressed file '/Library/Application Support/NoMachine/var/log/logrotate/nxserver.log-testNN-2023.07.17-16.02.52.gz'.

If not needed, you can safely delete the .gz archives.

4.2. Clear Server Logs Manually

How to clear the nxserver.log file by hand

On Linux and macOS it is possible to clear the nxserver.log without the need to shutdown services.


Linux

1) Open a terminal and become root:

$ sudo su

2) Clear the nxserver.log file by using the 'echo' command. Note that since the server is up and running, it will immediately print some logs after the cleaning.

$  echo "INFO: Logs cleaned on this host on `date`" > /usr/NX/var/log/nxserver.log 

You can modify the INFO string as you prefer.

macOS

1) Open a terminal and become root:

$ sudo su

2) Clear the nxserver.log file by using the 'echo' command. Note that since the server is
up and running, it will immediately print some logs after the cleaning.

$  echo "INFO: Logs cleaned on this host on `date`" > /Library/Application\ Support/NoMachine/var/log/nxserver.log

You can modify the INFO string as you prefer.

Windows

On Windows, it's necessary to shutdown the server before clearing the content of nxserver.log so that the file is no longer in use by another process. Shutting down the server will terminate all current sessions.

Open a CMD console as administrator and shutdown the server and all services:

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe  --shutdown

Then clear the content of nxserver.log:

> echo "INFO: Logs cleaned on this host "  > %PROGRAMDATA%\NoMachine\var\log\nxserver.log

You can modify the INFO string as you prefer.

Finally, restart the server and services:

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe  --startup

4.3. Activate Log Rotation

How to activate the automatic log rotation

Log rotation of NoMachine logs is not activated by default. Once activated, in the default configuration, logs are rotated once per month when they exceed 100MB. If not otherwise specified, NoMachine preserves up to seven rotated files and deletes the oldest ones.

The command to activate the automatic log rotation is 'nxserver --logrotateadd'. If not otherwise specified, it uses the default settings above. It's possible to specify different options as detailed in the Installation and Configuration guide of your server product, available at: https://www.nomachine.com/all-documents in section 'Installation.'

Linux and macOS

Open a terminal and run:

$ sudo /etc/NX/nxserver --logrotateadd 

Windows

Open a CMD console as administrator and execute:

> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe  --logrotateadd