I can not get any reliable information about how do kernel logs get from Kernel Ring Buffer to /proc/kmgs and /dev/kmsg. Is there any source I could have possbily missed or does perhaps anyone know from their head?

1 Answer 1


/proc/kmsg is handled by fs/proc/kmsg.c, /dev/kmsg is handled by the kmsg driver in kernel/printk/printk.c.

In both cases, logs aren’t copied from the ring buffer to the reader until a process reads from the relevant file descriptor.

  • Is there any description (documentation) about your explanation of such events in the back of OS? Aside of the actual code, which takes unfairly huge amount of time to understand. If it doesn't exist how did you learn about it? Commented Jan 9, 2023 at 10:40
  • I’m not aware of any documentation off-hand that mentions this (although I think it exists). I learned about this by reading the code — I know that’s not particularly helpful. Commented Jan 9, 2023 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .