This module collects kernel log messages from the kernel log buffer. This module works on Linux, the BSDs, and macOS.
|To examine the supported platforms, see the list of installer packages in the Available Modules chapter.|
|In order for NXLog to read logs from the kernel buffer, it may be necessary to disable the system logger (systemd, klogd, or logd) or configure it to not read events from the kernel.|
Special privileges are required for reading kernel logs. For this, NXLog needs to be started as root. With the User and Group global directives, NXLog can then drop its root privileges while keeping the CAP_SYS_ADMIN capability for reading the kernel log buffer.
Unfortunately it is not possible to read from the
<6>Some message from the kernel.
Kernel messages are valid BSD Syslog messages, with a priority from 0 (emerg) to 7 (debug), but do not contain timestamp and hostname fields. These can be parsed with the xm_syslog parse_syslog_bsd() procedure, and the timestamp and hostname fields will be added by NXLog.
The im_kernel module accepts the following directives in addition to the common module directives.
This directive sets the device file from which to read events, for non-Linux platforms. If this directive is not specified, the default is
This directive specifies how frequently the module will check for new events, in seconds, on Linux. If this directive is not specified, the default is 1 second. Fractional seconds may be specified (
PollInterval 0.5will check twice every second).
This configuration collects log messages from the kernel and writes them to file. This should work on Linux, the BSDs, and macOS (but the system logger may need to be disabled or reconfigured).
# Drop privileges after being started as root User nxlog Group nxlog <Input kernel> Module im_kernel </Input> <Output file> Module om_file File "tmp/output" </Output>