• Edit
  • Delete

systemd journald journalctl

journalctl

https://wiki.ubuntuusers.de/systemd/journalctl/

  • Give times
    • journalctl --since="yesterday"
    • journalctl --since="today"
    • journalctl --since="-1h" // last hour
  • Find unclean shutdowns during last week (power cut)
    • journalctl --no-pager --since="-1 month" | grep --context 1 ' Reboot ' | grep -zP '(?<!Journal stopped)\n\-\- Reboot'

 

journald

https://wiki.ubuntuusers.de/systemd/journald/

https://www.freedesktop.org/software/systemd/man/journald.conf.html

https://www.loggly.com/ultimate-guide/managing-journal-size/

  • Log files are in
    • /var/log/journal
  • Edit config
    • vi /etc/systemd/journald.conf
      • # persistent = store to disk in /var/log/journal
        #Storage=auto
        Storage =persistent
        
        # Limit the log size to given value, otherwise 4G
        #SystemMaxUse=
        SystemMaxUse=2G
  • Restart
    • systemctl restart systemd-journald
  • Show persitent log size
    • journalctl --disk-usage
  • Reduce storage size to 1G
    • journalctl --vacuum-size=1G
  •