Monitoring and recovery

Considerable resources continue to be invested in maintaining the quality and reliability of NXLog. However, due to the complexity of modern software, producing bug-free software is practically impossible. This section describes potential ways to automatically recover from an NXLog crash. Note that there are other monitoring solutions besides these presented here which may also be of interest.

Monitoring on Unix platforms

Monit can both monitor and recover NXLog after a crash. It supports macOS, Solaris, and several Linux distributions. Monit can be installed directly from your distribution’s package manager—see Installation on the Monit wiki for more information about the various installation options. Precompiled binaries can also be found here.

While Monit can monitor and react to several conditions, the configuration presented here instructs Monit to restart NXLog after a crash. To do so, include the following in the Monit configuration. It may be necessary to edit the paths to match your installation. Then restart Monit.

/etc/monit/monitrc
check process nxlog with pidfile /opt/nxlog/var/run/nxlog/nxlog.pid
   start program = "/etc/init.d/nxlog start"
   stop program  = "/etc/init.d/nxlog stop"
On recent Linux distributions employing systemd, the start and stop directives should use systemd calls instead (for example, /bin/systemctl start nxlog).

To simulate an NXLog crash, terminate the nxlog process by issuing the following command (where <PID> represents the current nxlog process ID).

# kill -9 <PID>

Monitoring on Windows

The Service Control Manager (SCM) in Microsoft Windows includes recovery options for each service. In the list of available services, find nxlog and right-click it. Select Properties and then choose the Recovery tab. As shown below, there are a number of different recovery options which can be configured.

SCM Recovery
Figure 1. Recovery settings in the SCM
Newer versions of NXLog enable automatic recovery during installation. For older versions, automatic recovery can be enabled by manually editing the values under the Recovery tab of the SCM.

To simulate an NXLog crash, execute the following in PowerShell (where <PID> represents the process ID of NXLog).

PS> Taskkill /PID <PID> /F