Running NXLog Agent
This page describes how to run and control NXLog Agent on Linux/UNIX and Windows, covering command-line options, default file locations, signals and service controls, and the nxlog-processor offline processing tool.
nxlog
nxlog is the main NXLog Agent service.
On Linux and UNIX systems it runs as a daemon; on Windows it runs as a Windows service.
On Windows, the executable is C:\Program Files\nxlog\nxlog.exe by default.
- Synopsis
nxlog [-c conffile] [-f]
nxlog [-c conffile] -v
nxlog [-r | -s]
- Options
| Option | Description |
|---|---|
|
Specify an alternative configuration file conffile.
To change the configuration file used by the Windows service, modify the |
|
Run in the foreground instead of as a service. |
|
Suppress output to STDOUT/STDERR. |
|
Print help. |
|
Reload the configuration of a running instance.
On Windows, stop and start the service instead: |
|
Send a stop signal to a running instance.
On Windows, use |
|
Verify the configuration file syntax. |
nxlog-processor
The nxlog-processor tool is similar to the NXLog Agent service and uses the same configuration file. However, it runs in the foreground and exits after it finishes processing the input data. Common input sources include files and databases. This tool is useful for data processing tasks such as:
-
Migrating data from files to a database
-
Converting between different data formats
-
Testing patterns
-
Correlating events offline
-
Checking HMAC message integrity
On Windows, the executable is C:\Program Files\nxlog\nxlog-processor.exe by default.
- Synopsis
nxlog-processor [-c conffile] [-v]
- Options
| Option | Description |
|---|---|
|
Specify an alternative configuration file conffile. |
|
Print help. |
|
Verify the configuration file syntax. |
File paths
The default installation paths differ between Linux/UNIX and Windows. If you installed NXLog Agent to a non-default location, adjust the paths accordingly.
-
Linux/UNIX
-
Windows
| Path | Description |
|---|---|
|
The main NXLog Agent executable. |
|
The nxlog-processor executable. |
|
A tool to check NXLog language statements. It reads statements from the standard input stream and validates them. If a statement is invalid, the tool prints an error to the standard error stream and exits with a non-zero value. |
|
The default configuration file. |
|
The NXLog Agent modules are located in this directory by default. See the ModuleDir directive. |
|
The default NXLog Agent log file. See the LogFile directive. |
|
If PersistLogqueue is set to |
|
The cache file that stores the last read position. See the NoCache, CacheDir, CacheFlushInterval, and CacheSync directives. |
|
The process ID (PID) of the currently running NXLog Agent process is written to this file. See the PidFile directive. |
| Path | Description |
|---|---|
|
The main NXLog Agent executable. |
|
The nxlog-processor executable. |
|
A tool to check NXLog language statements. It reads statements from the standard input stream and validates them. If a statement is invalid, the tool prints an error to the standard error stream and exits with a non-zero value. |
|
The default configuration file. |
|
The default NXLog Agent log file. See the LogFile directive. |
|
The default directory for NXLog Agent data files, including the cache and queue files. See the CacheDir and LogqueueDir directives. |
Controlling the agent
Once NXLog Agent is running, you can start or stop it, reload the configuration on the fly, or check its status. The commands to do this depend on your operating system.
-
Linux/UNIX
-
Windows
You can control the NXLog Agent process by sending it the following signals using the kill command.
| Signal | Effect |
|---|---|
|
Reload the NXLog Agent configuration and restart the module instances. |
|
Write an |
|
Switch NXLog Agent to debug log level.
This is equivalent to setting the LogLevel directive to |
|
Stop NXLog Agent. |
For example, the following command sends the SIGUSR1 signal:
$ kill -SIGUSR1 $(cat /opt/nxlog/var/run/nxlog/nxlog.pid)
On Windows, NXLog Agent runs as a service managed through the Windows Service Control Manager.
Use the sc command to control it from the command prompt, or use the Services MMC snap-in (services.msc).
| Command | Effect |
|---|---|
|
Start the NXLog Agent service. |
|
Stop the NXLog Agent service. |
|
Write an |
|
Switch NXLog Agent to debug log level. |
For example, the following command sends the status request:
> sc control nxlog 200
Environment variables
To access environment variables from the NXLog Agent configuration on both Linux and Windows, use the envvar directive.