How do I disable kernel logging into the systemd journal?
Good Linux/Sysadmin practice would recommend you go with something like fzbd's solution in which you're silencing the specific log you don't need to see rather than disabling kernel messages wholesale.
Nevertheless, it's still worth mentioning that as of systemd 235, there's an option for disabling kernel messages within journald.conf
file. The main journal.conf docs mention this option which allows you to disable journald from reading /dev/kmsg
.
Version 235 may not be found in many distributions just yet, so you can check your systemd version with:
systemctl --version
If you have version 235 or above you can proceed by first making a backup of the original /etc/systemd/journald.conf file and then uncommenting the relevant line and changing it from yes
to no
:
ReadKMsg=no
Save, exit, and restart your journald service:
sudo systemctl restart systemd-journald.service
See if your device's kernel module has some logging/debug parameter which you can disable:
modprobe $module_name
ls /sys/module/$module_name/parameters
If not, for systemd with version < 235, the best you can do is filter messages by log level, for example:
journalctl --priority=3
You can check the log values with man syslog
.
Note that lowering the kernel logging levels using kernel.printk
only affects console logging, so userland applications will still show the same messages, regardless of the values in this parameter.