imklog bug with nonkernelfacility and new syntax #477

Closed
jite opened this Issue Aug 12, 2015 · 11 comments

Comments

Projects
None yet
7 participants

jite commented Aug 12, 2015

(Pasting description from mail on mailing list 2015-07-08 12:10 GMT+02:00)

If I load imklog with option like this:

$ModLoad imklog
$KLogPermitNonKernelFacility on

it works as expected, I do get non-kernel facility messages, however if
I load it the new way:

module(load="imklog" permitnonkernelfacility="on")

I'm not getting any non-kernel facility messages and I don't see any
warnings in the log either. I've tried other values as "yes", "1", etc
with no luck.

@jite jite changed the title from imklog doesn't work with new syntax in config to imklog bug with nonkernelfacility and new syntax Aug 12, 2015

Owner

alorbach commented Aug 12, 2015

I have run rsyslog in debug mod with "2&>1 | grep permitnonkernelfacility",


module(load="imklog" permitnonkernelfacility="off")

7874.791806032:main thread : name: 'permitnonkernelfacility', value 'off'
7874.791894176:main thread : nvlstGetParam: name 'permitnonkernelfacility', type 4, valnode->bUsed 0
7874.791897753:main thread : permitnonkernelfacility: 0


module(load="imklog" permitnonkernelfacility="on")

7912.758151592:main thread : name: 'permitnonkernelfacility', value 'on'
7912.758279489:main thread : nvlstGetParam: name 'permitnonkernelfacility', type 4, valnode->bUsed 0
7912.758284455:main thread : permitnonkernelfacility: 1


So technically the property is set correctly.

jite commented Aug 13, 2015

Alright, did you also try running it and log messages to the kernel log with nonkernel facility set? I can't get that to work with the new syntax but it does work for me with the old syntax.

Owner

alorbach commented Aug 13, 2015

Can you post a minimal working configuration which I need to reproduce the problem?
I tested on Ubuntu, do I need to run the tests on Freebsd?

jite commented Aug 13, 2015

Hmm, I can see if I can scale it down, but it's running on an embedded Linux device right now (mips).

Just to verify: Did you try to write to the kernel log with nonkernel-facility and actually saw the message appear when using the new syntax ? (I just had a . /var/log/testfile.log as a rule (and a /dev/console rule too))

Owner

alorbach commented Aug 14, 2015

I think the configuration I used for testing is not suitable.
If you share your configuration and method to write nonkernel messages into the kernel log, this would make troubleshooting a lot easier ;)

jite commented Aug 19, 2015

Sorry for the delay. Simplest conf file that reproduced the issue for me:

module(load="imuxsock" SysSock.RateLimit.Interval="0")

module(load="imklog" permitnonkernelfacility="on")                                                            

#$ModLoad imklog
#$KLogPermitNonKernelFacility on

$WorkDirectory /var/spool/rsyslog
*.* /var/log/tmp.log

Then just run echo test1 >/dev/kmsg and perhaps echo test2 >/dev/kmsg when uncommenting the old syntax and commenting out the new. Then check the log file.

plugins/imklog/imklog.c:197: I hooked myself in here, and bPermitNonKernel == 0 no matter the value of permitnonkernelfacility="" in the config when using the new syntax. When using the old syntax it gets set correctly.

jite commented Aug 26, 2015

Did my last message contain enough information for you to reproduce the issue? Let me know if you need something more/else. Thanks

i too am experiencing the same issue as @jite on ubuntu 14.04 with rsyslog 8.12.0-0adiscon1trusty1

Can confirm this issue is present in 8.26.0 on trusty 14.04 as well

@erikanderson erikanderson referenced this issue in rsyslog/rsyslog-pkg-ubuntu May 4, 2017

Closed

imkmsg.so module present in ubuntu base but not in ppa #58

Owner

rgerhards commented May 8, 2017

@PascalWithopf Can you please try to reproduce it? A manual repro is fine here IMHO, as we need root permissions anyways (which we do not usually have on the CI machines). But we might discuss how to support that on some environment :-)

PascalWithopf added a commit to PascalWithopf/rsyslog that referenced this issue Jul 18, 2017

imklog: Fix permitnonkernelfacility not working
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 rsyslog#477

@rgerhards rgerhards added this to the v8.29 milestone Jul 19, 2017

@rgerhards rgerhards added the bug label Jul 19, 2017

@rgerhards rgerhards closed this in #1674 Jul 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment