ā±ļø 1 min read • šŸ“ 136 words

:material-penguin:{ .anim-heart }Systemd

Socket activation#

Systemd has a neat little feature where a daemon can turn on whenever a connection is made to it. Works with Unix and network sockets. More details here . Essentially you create a socket file alongside your service file. The advantage is that you don’t need to start your services in a specific order.

Flush old logs in journalctl#

By date or by size:

    sudo journalctl --vacuum-time=2d
    sudo journalctl --vacuum-size=500M

Tail journalctl#

journalctl -f

For a specific service:

journalctl -u httpd -f

Store logs on disk#

(from http://unix.stackexchange.com/questions/159221/how-display-log-messages-from-previous-boots-under-centos-7 )

On CentOS 7, you have to enable the persistent storage of log messages:

# mkdir /var/log/journal
# systemd-tmpfiles --create --prefix /var/log/journal
# systemctl restart systemd-journald

Otherwise, the journal log messages are not retained between boots. This is the default on Fedora 19+.