Useful journald tweaks

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


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+.

Leave a Reply