📝 Kernel module that can be used as a replacement for syslog, logger or logwrapper
Kernel logger is a kernel module that can be used as a replacement for logger
or logwrapper
.
Its log is similar to systemd's journal and can be read by dmesg
or journalctl
.
logger
again and again in a shell script.Here is a very suitable use case.
logger
needs a backendmake
sudo insmod logger.ko
vagrant@ubuntu-focal:/vagrant$ echo "This is just a test" > /dev/logger
vagrant@ubuntu-focal:/vagrant$
vagrant@ubuntu-focal:/vagrant$ dmesg | grep "This is just a test"
[ 55.750168] bash[1289]: This is just a test
vagrant@ubuntu-focal:/vagrant$
vagrant@ubuntu-focal:/vagrant$ journalctl -b | grep "This is just a test"
Mar 04 02:13:46 ubuntu-focal bash[1289]: This is just a test
Just add the following to the beginning of your shell script:
exec > /dev/logger 2>&1
This project is licensed under GPL-2.0.