Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between /proc/kmsg and dmsg?

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?

like image 845
Saurabh Sengar Avatar asked Jan 30 '15 11:01

Saurabh Sengar


People also ask

What is Proc KMSG?

/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.


2 Answers

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.

like image 141
R.D. Avatar answered Oct 22 '22 10:10

R.D.


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

like image 26
Tarun Gupta Avatar answered Oct 22 '22 11:10

Tarun Gupta