AFAIK dmesg
shows information about kernel and kernel modules, and /var/log/messages
also shows information produced by kernel and modules.
So what's the difference? Does /var/log/messages
⊂ output of dmesg
?
More Info that may be helpful:
– There is a kernel ring buffer, which I think is the very and only place to store kernel log data.
– Article "Kernel logging: APIs and implementation" on IBM DeveloperWorks described APIs and the bird-view picture.
Best Answer
dmesg
prints the contents of the ring buffer. This information is also sent in real time tosyslogd
orklogd
, when they are running, and ends up in/var/log/messages
; whendmesg
is most useful is in capturing boot-time messages from beforesyslogd
and/orklogd
started, so that they will be properly logged.