Search code examples
loggingubuntu-18.04diskspacejournal

How to manage files in /var/log/journal/ in ubuntu 18.04?


I want to learn about and manage the directory /var/log/journal/ in ubuntu 18.04

  • What data is logged to it and when?
  • Is there any issue in deleting all files from that directory?
  • Is there any way to set delete old data (eg. 1 month)?

Solution

  • I have learned it in weak end - adding a short note here

    • journald is - systemd’s logging service

    • Journalctl is a utility for querying and displaying logs from journald

    • the logs are stored in /var/log/journal/ (except, when we delete the directory)

    • we can manage the size and etc in /etc/systemd/journald.conf

    • useful journalctl commands

      • journalctl - to view all logs
      • journalctl --disk-usage - to check disk usage
      • journalctl --since "2020-09-24 00:00:00" --until "2020-09-24 23:59:59" - to view logs in between this time range
      • journalctl -f - tail the logs