NoMachine Support

Your questions answered

Knowledge Base

Searching in: Feature Requests
Filter the search results
Target version:
Last update:
Searching in: Feature Requests
ID: FR03Q03791
Added on:  2019-03-04
Last update: 2019-05-23
Priority: Configuration
Products: NoMachine Server
Target: 6
Status:  Implemented
Extending the session history command to provide statistics and debug information

This FR is a general improvement of the  'nxserver --history' command to extend its capabilities and provide additional functionalities, such as the ability to elaborate session statistics and print the output of the command to a file.

In detail, improvements are the following.

1) Display more relevant information for the single session when running:

nxserver --history <sessionID>

In case of a failed session, the output should report two separated sections showing the error and a more longer report written in the same format of nxserver.log, included timestamp. 

The two sections can be identified by titles 'Error is:' and 'Report:'. This could be helfpul, especially in case of session failure, for the initial investigation of the problem. It can help for example to determine if the session has been terminated because of system resources exceeded, disk full or any other reason.

For example

$ sudo /etc/NX/nxserver --history 118FB9FB0FB22BB004C7F9AD85AA4054

Error is:
2019-04-03 18:26:33 641.517 23932 NXSERVER ERROR! Connection to  nxnode process of 118FB9FB0FB22BB004C7F9AD85AA4054 closed unexpectedly.

Short report:
2019-04-03 18:26:32 641.517 23932 NXSERVER - Version 6.6.3 - LTSE Evaluation
2019-04-03 18:26:32 641.517 23932 Running as user: 'nx' (uid: 117, pid: 23932) on ''
2019-04-03 18:26:32 641.517 23932 NXSERVER User 'nxtest01' logged in from '' using authentication method NX-password.
2019-04-03 18:26:33 641.517 23932 NXSERVER ERROR!Connection to  nxnode process of 118FB9FB0FB22BB004C7F9AD85AA4054 closed unexpectedly.
[...] For the complete report, please check the NoMachine server log.


2) Calculating session statistics:

nxserver --history --stats

This new option will also allow administrators to print statistics about number of sessions, startup time, number of sessions terminated and so on. Statistics could report information like:

NX> 900 Session statistics from 2019-03-01 to 2019-03-05 (5 days)
Sessions started: 400
Sessions running: 200
Sessions connected: 1
Sessions terminated: 195
Sessions failed: 5
Sessions unknown: 0
Average startup time: 4.321 seconds
Fastest startup time: 1.5 seconds, session id: A3224323423EE23..., session type: shadow,  started at: 2019-03-04 14:49:04 776.652
Longest startup time: 13 seconds, session id: BAF245A9E2AE9F2... session type: virtual desktop, started at 2019-03-05 08:09:27 155.692
Oldest session uptime: 45 days, session id: FE2... session type: virtual desktop, started at 2019-02 ...

Gathering statistics for hundreds of sessions may require some time, the server will print this messag while it retrieves and elaborates data:
Calculating statistics, please wait...
This message could be printed periodically (every 5 seconds) if retrieving statistics takes longer.


3) Redirecting the output of the 'nxserver --history OPTIONS' command to a file.

nxserver --history --file <filename>

By default, sessions' history is printed on standard output, but it should be possible to specify a file to redirect the output. This applies to all the history switches, for example:

nxserver --history <sessionID> --file <filename>

nxserver --history --stats --file <filename>

The new server usage for the nxserver --history command is:

--history [<sessionid> | <username> | clear] [--client-type]
          [--client-version] [--client-platform] [--stats]
          [ --file <file]

  Show history of all sessions on standard output, including those
  that are terminated or failed. Redirect the output to a given
  file if --file is given, this can be used in conjunction with all
  the other options. The history backlog lasts for the number of
  seconds specified in the server configuration, reset it by using
  the 'clear' option.  Specify <sessionid> to show information about
  the session, included debug logs if the session is failed. Provide
  <username> to list only sessions of that user. When --client-type,
  --client-version and --client-platform are given, show information
  about the client. Provide the --stats option to elaborate sessions