permitnonkernelfacility doesn't work when the new configuration syntax
is used, e.g. 'module(load="imklog" permitnonkernelfacility="on")'.
It does work with the old syntax, e.g. '$KLogPermitNonKernelFacility
on'
This is because the old style config is stored in a static global
struct "cs", while the new style config is passed in as a pointer.
Code in imklog will put old style config entries into the new config
struct, and almost all the code in imklog uses the new config struct
like it should. Except for a check for bPermitNonKernel in Syslog()
that continued to use the static global that only has old style
configs.
Fix this by passing pModConf down into Syslog() and using that in
place of the static global.
closes https://github.com/rsyslog/rsyslog/issues/477
Remove the use sizeof(char) or sizeof(uchar) in calculations for memory
allocation or string length. There are no known platforms for which
sizeof(char) or sizeof(uchar) is not 1, and c99 has defined sizeof(char)
to be 1 (section 6.5.3.4 of c99).
most importantly, we do no longer use the LOG_FAC() and LOG_PRI() macro
names, which may conflict with systems names and may act other than
expected by a user.
Note: this was not a simple merge, I rather needed to adopt the v5 code to
the new v6 config handling. However, no v6 config format has been added yet
(this is the next step).
Conflicts:
plugins/imklog/imklog.c
plugins/imklog/imklog.h
When enabled, kernel message [timestamp] is converted for message time.
Default is to use receive time as in 5.8.x and before, because the clock
used to create the timestamp is not supposed to be as accurate as the
monotonic clock (depends on hardware and kernel) resulting in differences
between kernel and system messages which occurred at same time.
The Linux driver no longer supports outdated kernel symbol resolution,
which was disabled by default for very long. Also overall cleanup,
resulting in much smaller code. Linux and BSD are now covered by a
single small driver.
If the kernel time-stamps messages, time is now take from that
timestamp instead of the system time when the message was read. This
provides much better accuracy. Thanks to Lennart Poettering for
suggesting this feature and his help during implementation.
if systemd writes a kernel log entry with a non-kernel priority,
the priority recorded in the kernel log will be wrong. However,
it will be immediately followed by another priority (with the
kernel timestamp in between, if enabled). So imklog now tries
to see if there is a second PRI and, if so, uses it. Note that
we already support non-kernel PRIs in the kernel log, as this
was done in BSD for quite some while. HOWEVER the config
statement "$klogpermitnonkernelfacility on" must be used to
permit this (otherwise non kernel messages are dropped).
Sample of a such a message on a kernel without timestamping
enabled:
$ echo '<14>text' > /dev/kmsg
$ dmesg -r
<4><14>text
NOTE: support for timestamp is NOT YET ENABLED!
The capability has been added for module to specify that they do not
like being unloaded.
related bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=222
Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>