6

How does dmesg differentiate between different log levels?

I can execute dmesg -l err to see all the error logs but when I look at the data with just dmesg or just cat the /var/log/dmesg file, there is no tag/string/identifier in the log text that can differentiate err from warn.

How does dmesg store this differentiation of log levels? How does it work?

Hussain Nagri
  • 181
  • 1
  • 9

1 Answers1

12

The dmesg(1) command does not read the /var/log/dmesg file, rather, it reads /dev/kmsg which contains the necessary syslog facility and priority information.

user9517
  • 115,471
  • 20
  • 215
  • 297