1819803 Members
2957 Online
109607 Solutions
New Discussion юеВ

Re: dmesg vs syslog.log

 

dmesg vs syslog.log

I had a discussion with another sa. I told him I had dmesg setup in cron to output to /var/adm/messages. He said that was redundant since that same information is in syslog.log. I disagreed with him but wondered if there was something explaining that at HP somewhere? I say that the information might be in dmesg and not syslog.log is why I do that.

Michael
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: dmesg vs syslog.log

A simple examination of the contents of the dmesg buffer versus the contents of the syslog file would make it pretty obvious that they were different.

A careful examination of the man pages would also point out the difference. Dmesg is dianostics, syslog can be most anything, depending on how it is configured - but it rarely contains any of the dmesg diagnostics.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: dmesg vs syslog.log

Well, you are both wrong, kinda, sorta. First, dmesg is a circular buffer of fixed size so that once the buffer fills, only the most recent data are available but messages can be stored in this buffer before /var is even mounted. Secondly, syslog does as syslog is configured so that messages in syslog may or may not correspond to those in dmesg. Your approach has merit because those two logs are not always the same. You should be aware that regardless of the cron period, it is possible to fill the dmesg buffer so that data are lost between cron captures.
If it ain't broke, I can fix that.

Re: dmesg vs syslog.log

Thanks to both of you. This is why I recommended putting in cron:
05,15,25,35,45,55 * * * * /usr/sbin/dmesg - >>/var/adm/messages 2>&1

As we used to do that to give you time and dates when entries are put in and also a running record. Works nicely.

Michael
DCE
Honored Contributor

Re: dmesg vs syslog.log


Michael,

As Clay stated, dmesg is a fixed length rolling buffer. I have seen it fill up and roll over in less than 10 minutes. I would rely on your cron job to capture all of the output of dmesg.

If you really want the dmesg output you could try runnong a tail -f > /var/adm/some_sile_name against it in the background
Kent Ostby
Honored Contributor

Re: dmesg vs syslog.log

There is some overlap here and syslog.log is nice because it gets timestamped.

You may want to consider a way to timestamp the dmesg output that you are sending to /var/adm/messages or adding an echo command that puts the time in there as well.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"

Re: dmesg vs syslog.log

Using the cron entry above does that. You get date/time stamp. That at least confirms when an entry made it into dmesg. I know I've seen entries before using that method and wondered if it was new or old. The cron entry method at least does that.

Michael