Configuring syslog for bash script logging
6,289
You could use the utility logger
, as in the following example:
logger -p local0.notice -t MYTAG "my message"
In the default rsyslog
configuration, it will appear on /var/log/syslog
as
Jul 11 12:16:23 enzotib-laptop MYTAG: my message
If you want to log to some other file, you should modify /etc/rsyslog.d/50-default.conf
, or better add another files under the same directory.
Related videos on Youtube
Author by
David Parks
Updated on September 18, 2022Comments
-
David Parks over 1 year
I want to use syslog to do some bash script logging.
I see /etc/rsyslog.d/50-default.conf, but I'm new to syslog. I want to configure local0 for logging for my scripts.
Should I be editing this configuration file? It has a bizarre name that throws me off. Or should I be creating some new file for my configuration that gets read somehow?
I just want to follow established standards here.