Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> logger commnad for kern.*, it doesn't work correctly about logger
music007
 Posted: Feb 8 2016, 08:19 AM
Quote Post


SLF Newbie


Group: Members
Posts: 2
Member No.: 3614
Joined: 8-February 16









Hello ALL

Machine Spec is here

OS:Sientific Linux 5.4
kernel:2.6.18-164.15.1.el5


I tried to have logger command to output kern.* messages on /var/log/kernel.
But it was showed nothing on /var/log/kernel.


I found this topic, is this bug?
https://bugzilla.redhat.com/show_bug.cgi?id=585533

Many people say on internet it's easy to output kern.* message by logger command.
I don't know whether this is bug.


******/etc/syslog.conf*************

kern.* /var/log/kernel

*******************************

I tried logger command after restarting of syslog service.

# logger -p kern.info "test"




Thanks.


PM
^
helikaon
 Posted: Feb 8 2016, 10:12 AM
Quote Post


SLF Administrator
*******

Group: Admins
Posts: 833
Member No.: 4
Joined: 8-April 11










Hi,

hmm .. as far as i remember from SL5 / RHEL5 , the way you do it, is the right way and should work.

Thing is, than you need to tune up the syslog config file - because those testing messages you're sending in - eg. that command you tried
CODE

logger -p kern.info "test"

will log the the testword "test" to
CODE

/var/log/messages

file and not to the /var/log/kernel

i think it has something to do with specification of the /var/log/messages in the conf file, where it says "*.info" so it (imho) simply has a precedence.

So some tune up of your conf file should take place smile.gif


cheers

--------------------
PMEmail Poster
^
music007
 Posted: Feb 9 2016, 07:23 AM
Quote Post


SLF Newbie


Group: Members
Posts: 2
Member No.: 3614
Joined: 8-February 16









Hello helikaon

Thank you for your reply.

I forgot to say,
it's failed to output kernel message via logger command,
but it's showed surely on /var/log/kernel when syslog service is restarted.

So I think config setting of "/etc/syslog.conf" is correct.

And I found this comment.
https://community.oracle.com/thread/3684791?start=0&tstart=0

This is the expected behavior to prevent kern messages coming from userland.

From syslog(3C) man page:

LOG_KERN Messages generated by the kernel. These cannot
be generated by any user processes.

When kern facility is used, the facility is reverted to the default one:

The initial default facility is LOG_USER.


I think this comment is correct, and it's the same with behavior of my machine.
I agree if anyone send kernel message freely, it's bad for sysytem.



How do you think this matter?






PM
^
helikaon
 Posted: Feb 12 2016, 08:57 AM
Quote Post


SLF Administrator
*******

Group: Admins
Posts: 833
Member No.: 4
Joined: 8-April 11









Hi,
this is more likely for some coder/dev to explain, but my common sense says, it's because of a security reasons.
Kernel is a 'heart' and 'brain' of the system and is directly 'talking' to HW so it's probably not a good idea that userland SW would have a access to same elevation like kernel facility ... smile.gif

Anyone here can get better/broader explanation?

cheers

--------------------
PMEmail Poster
^
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll