Knowledge Base
Searching in : Article
ID: AR04D00379
Applies to: NX Software
Added on: 2006-04-13
Last Update: 2009-10-21
Print this article

Avoiding excessive log files

On some occasions it has been noted that the NX logs increase dramatically in size due to errors and/or warnings being generated by certain Linux applications which are being written to the server side logs. This excessive file size causes user sessions to be terminated. Session termination, in this case, is a measure adopted by NX server to prevent abnormal file growth.

Please note that changes to the configuration files only affect newly created sessions.  Ongoing or suspended sessions will use the prior settings until the sessions are restarted or killed.

Changes to the configuration files take effect immediately for newly created sessions.  A restart of the NX Server is not needed for the changes to take effect.

How to avoid excessive log files in NX 3.0.0 or later

The following keys are available in the NX Node configuration file, i.e. /usr/NX/etc/node.cfg:

#
# Enable or disable NX node to log the X client stderr.
#
# 1: Enabled. The standard error of the X clients is redirected to
#    the 'clients' file in the session directory.
#
# 0: Disabled. The standard error of the X clients is redirected to
#    /dev/null.
#
#ClientLog = "1"

#
# Set the maximum size allowed for the log of the X clients. The node
# will terminate the session if this limit is exceeded. The default
# value is 4194304 bytes (4MB).
#
#ClientLogLimit = "4194304"


How to avoid excessive log files in NX 2.0.0

The following keys are available in the NX Node configuration file, i.e. /usr/NX/etc/node.cfg:

#
# Enable or disable NX node to log the X client stderr.
#
# 1: Enabled. The standard error of the X clients is redirected to
#     the 'clients' file in the session directory.
#
# 0: Disabled. The standard error of the X clients is redirected to
#     /dev/null.
#
#CLIENT_LOG = "1"

#
# Set the maximum size allowed for the log of the X clients. The node
# will terminate the session if this limit is exceeded. The default
# value is 4194304 bytes (4MB).
#
CLIENT_LOG_LIMIT = "4194304"


How to avoid excessive log files in NX 1.5.0 and earlier

The system of log file management in NX 1.5.0 and earlier does not separate its own internal messages from those of user applications. This means that the NX logfile can grow quickly if errors and/or warnings are generated by the system that are non-NX related yet logged in the NX logfile due to other Linux applications misbehaving. Such rapid growth can cause sessions to terminate due to either reaching the log limit or filling the disk. Such growth can be managed and/or mitigated with some tools already available to the administrator:

1. By properly configuring Linux applications so that they do not generate these errors and/or warnings which are non-NX related yet logged by the NX logs. In general, rapid NX session log file growth has been seen to occur with mis-configured Linux applications not related to NX. Therefore, we recommend that users look to fix the problems with those applications before applying any work-arounds.

2. In node.cfg configuration files there is the following key:

#
# Set the maximum size allowed of the session log. The server will
# terminate the session if this limit is exceeded. The default value
# is 4194304 bytes (4MB).
#
#SESSION_LOG_LIMIT = "4194304"

As you can see the limit is 4MB, so you can change this to increase it.

3. By changing the log file location as specified here:

There is a known workaround to solve this issue; please follow the steps below; the main idea is to redirect the session log file elsewhere so that the internal watchdogs of NX server are not alerted.

 

A. Login as the 'root' user on the system hosting the NX server installation.

B. Change the current working directory to the server configuration root:

cd /usr/NX/etc

C. Make a backup copy of the server configuration file; for example:

cp -a node.conf node.conf.ori

D. With your preferred text editor open the configuration file and append a line similar to the following at the end of the file:

COMMAND_START_KDE = "startkde 1>/tmp/kdelog.$$ 2>&1"

 

Please note that doing so will make the changes available to all the users. You can, instead, choose to apply this behavior only to a specific user; in order to do so you must create a configuration file for the specific user:

 

A. A. cp -a node.conf username.node.conf

B. Then make sure that a line similar to the following is appended to the end of the file just created:

COMMAND_START_KDE = "startkde 1>/home/username/kdelog.$$ 2>&1"

 

Finally, if you don't intend to modify the global or user-specific server configuration, you can adopt the following approach:

 

A. Configure a NX session as 'UNIX' - 'Custom' so that a new 'xterm' is launched at startup.

B. Launch the session just configured and, from the xterm prompt, execute the following to actually start the Desktop Environment:

startkde 1>/home/foobar/kdelog.$$ 2>&1