



Collect server side logs automatically
Table of Contents
Introduction
NoMachine servers provide command line tools 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 following instructions have to be executed from command line 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, 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 '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 from journalctl or from syslog. For example:
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. Short Instructions
1) Enable debug level on the problematic server/node machine:
nxserver --debug --enable all
2) Connect to the NoMachine server and reproduce the problem.
3) Create the log archive on the server/node machine:
nxserver --debug --collect
4) Collect client side logs on user's device (if requested).
5) Send logs to Support Team as e-mail attachment (keep the ticket ID in the subject).
6) Restore Informational log level on the server/node machine:
nxserver --debug --disable all
When the problem is easily reproducible or if the Support Team requested that, you may clean the logs before starting the procedure above to collect them:
nxserver --logrotate
2. Detailed Instructions
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:
> %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 and macOS
$ sudo /etc/NX/nxserver --debug --collect
If you are the root user, run the command above without 'sudo'.
The log archive is named as: NoMachine-log-<timestamp>.zip (e.g. NoMachine-log-2018.09.27-11.44.01.zip) and stored in: /usr/NX/var/log/archives or /Library/Application Support/NoMachine/var/log/archives on Linux and macOS respectively.
Windows
> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --debug --collect
The log archive is named as: NoMachine-log-<timestamp>.zip (e.g. NoMachine-log-2018.09.27-11.44.01.zip) and stored in: %PROGRAMDATA%/NoMachine/var/log/archives on Windows 11, 10, 8.x, 7 and Vista.
Fourth Step: Collect Client Side Logs (if requested)
The following instructions have to be done to the user's device.
Inside the NoMachine session, open the menu panel by ctrl+alt+0 or click on the page peel at the top right corner of the window. Open 'Connection' and click on 'Take the logs' button on the left and choose where to save logs. A copy of the session directory is created to store logs and named as session name plus date. Compress it to create the log archive to be sent to Support Team.
As an alternative, to be used for example to debug a problem which causes a session freeze, be sure that the Don't delete log files on exit checkbox is selected in UI -> Settings -> Player -> Security panel before launching the client to reproduce the problem. Do not close the client once problem has been reproduced.
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.gz
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 may 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).
To do that, force the rotation of NoMachine logs by executing:
Linux and macOS
$ sudo /etc/NX/nxserver --logrotate
If you are the root user, run the command above without 'sudo'.
Windows
> %ALLUSERSPROFILE%\NoMachine\nxserver\nxserver.exe --logrotate
Rotated files are saved in the NoMachine var/log/logrotate directory:
/usr/NX/var/log on Linux
%PROGRAMDATA%/NoMachine/var/log on Windows
/Library/Application Support/NoMachine/var/log on macOS
and named as:
nxserver.log-user for log archive from user's home/.nx
nxserver.log for log archive from NoMachine's var/log/