We normally do cat /proc/kmsg
or dmesg
to see the kernel logs from user space.
I understand the dmesg
is a circular buffer which copies from kmsg
But is kmsg
also not a circular buffer?
I want to understand the difference and relation between them?
/proc/kmsg provides a root-only, read-only, consuming view of the kernel log buffer. It's equivalent to calling syslog(2) with the SYSLOG_ACTION_READ action. As mentioned in the proc manpage, A process must have superuser privileges to read this file, and only one process should read this file.
Loosely speaking dmesg is a program that dumps /proc/kmsg. In addition, it provides some filtering capabilities to weed out logs that the user isn't interested in.
output of /proc/kmsg can be directed to a file when collecting large amount of logs so that no logs are lost
dmesg is circular buffer and previous logs get overwritten once buffer is full
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With