Journalctl: Difference between revisions

From DikapediaV2
Jump to: navigation, search
No edit summary
No edit summary
 
Line 24: Line 24:
  . . .
  . . .
  Deleted archived journal /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a/user-1000@e6ecd2f858d1498b9a445af7bac00bbf-000000000000063a-0005848ac99802b3.journal (8.0M).
  Deleted archived journal /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a/user-1000@e6ecd2f858d1498b9a445af7bac00bbf-000000000000063a-0005848ac99802b3.journal (8.0M).
Vacuuming done, freed 88.0M of archived journals from  
Vacuuming done, freed 88.0M of archived journals from  
  /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a.
  /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a.
   
   

Latest revision as of 17:09, 2 September 2024

journalctl --no-pager --catalog --boot


Journalctl Disk Usage


Check Journalctl disk usage:

[ec2-user@ringroadlimo ~]$ journalctl --disk-usage
Archived and active journals take up 1.0G on disk.

Journalctl will take up space over time in the directory /var/log/journalctl/*. It is safe to delete the contents but do not delete the directory.

You can control the size of this directory using this parameter in your /etc/systemd/journald.conf:

SystemMaxUse=50M

To clean logs after a period of time rather than when they reach a certain size, you can set the parameter MaxRetentionSec instead of SystemMaxUse. See man journald.conf for more details.

You can also clean based on time: journalctl --vacuum-time=10d

# du -sh /var/log/journal
113M    /var/log/journal
# journalctl --vacuum-time=10d
Deleted archived journal 
/var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a/system@36170b4530af4c89ac4d84ac68f8b727- 0000000000000001-00057b09da23eb2c.journal (8.0M).
Deleted archived journal /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a/user-1000@54176301a0c74c4698c3b6a549e1b2ed-0000000000000874-00057b0c1a491094.journal (8.0M).
. . .
Deleted archived journal /var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a/user-1000@e6ecd2f858d1498b9a445af7bac00bbf-000000000000063a-0005848ac99802b3.journal (8.0M).
Vacuuming done, freed 88.0M of archived journals from 
/var/log/journal/f77f9567bb70f8e7b5d9a0c95bef5c2a.

root@monroe:/var/log# du -sh /var/log/journal     
25M     /var/log/journal

You can force a log rotation:

$ sudo systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service

NOTE: You might need to restart the logging service to force a log rotation, if the above signaling method does not do it. You can restart the service like so:

$ sudo systemctl restart systemd-journald.service

Reference: https://unix.stackexchange.com/questions/130786/can-i-remove-files-in-var-log-journal-and-var-cache-abrt-di-usr