What's the difference of dmesg output and /var/log/messages?
dmesg
prints the contents of the ring buffer. This information is also sent in real time to syslogd
or klogd
, when they are running, and ends up in /var/log/messages
; when dmesg
is most useful is in capturing boot-time messages from before syslogd
and/or klogd
started, so that they will be properly logged.
That depends on the operating system. For example on Solaris, dmesg is simply a shell script showing the last 200 lines of the /var/adm/messages.*
files.
- We can say that
dmesg
is the subset of/var/log/messages
and is maintained in ring buffer. /var/log/messages
includes all the system messages including from starting of the system along with the messages indmesg
. In a nutshell logs fromdmesg
are dumped in/var/log/messages
./var/log/messages
maintain the general system activity logs anddmesg
maintains only the kernel logs.