Syslog: Difference between revisions
WhyNotHugo (talk | contribs) m (Typo) |
WhyNotHugo (talk | contribs) (Move other distributions further down) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{TOC right}} | {{TOC right}} | ||
Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation | Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation. Alpine installs <code>syslog</code> as provided by {{pkg|busybox}} per default, but it also packages [https://pkgs.alpinelinux.org/packages?name=*syslog* other implementations], such as {{pkg|rsyslog}}, {{pkg|syslog-ng}}, [https://skarnet.org/software/s6/s6-socklog.html s6-socklog] (from {{pkg|s6}}) and [[logbookd]]. This role is typically fulfilled by <code>journald</code> on systemd-based systems. | ||
== busybox syslog == | == busybox syslog == | ||
| Line 26: | Line 26: | ||
</nowiki>}} | </nowiki>}} | ||
== Writing logs == | |||
Many applications are able to write to the syslog by default (e.g. <code>sshd</code>). If you wish to write manually to it, use the <code>logger</code> program. | Many applications are able to write to the syslog by default (e.g. <code>sshd</code>). If you wish to write manually to it, use the <code>logger</code> program. | ||
Latest revision as of 23:15, 5 December 2025
Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation. Alpine installs syslog as provided by busybox per default, but it also packages other implementations, such as rsyslog, syslog-ng, s6-socklog (from s6) and logbookd. This role is typically fulfilled by journald on systemd-based systems.
busybox syslog
Running syslogd
Depending on how you have installed Alpine, it is already running (check with ps a | grep syslogd). Otherwise enable it at boot and start it with the following commands:
# rc-update add syslog boot # rc-service syslog start
Configuration
Edit /etc/conf.d/syslog to change the options used when running syslogd. All available options can be looked up with syslogd --help.
Reading logs
# tail -f /var/log/messages Shows all messages and follows the log # tail -f /var/log/messages | grep ssh Only shows SSH related messages, also follows the log
When -C is enabled in the configuration:
# logread -f # logread -f | grep ssh
Writing logs
Many applications are able to write to the syslog by default (e.g. sshd). If you wish to write manually to it, use the logger program.
$ logger "hello world"