Making journalctl delete log entries older than a given date - how to do it
Question: How to make journalctl trim entries older than a certain date
My problem:
journalctl does not seem to trim journals as it should.
My environment: Up to date Archlinux 64bit on Thinkpad
What I have tried:
Reading the info page on systemctl journalctl, and ran this:
[root@archover ~]# journalctl --vacuum-time=4days
Vacuuming done, freed 0B of archived journals from /var/log/journal/2cfd9dec960b4861aecb88a76fc32810.
Which, i believe, shows nothing to do since i executed that command just a few minutes ago.
Yet, when I run this:
journalctl
It returns entries from June 2016 and newer
If it helps, here's more data points:
[root@archover ~]# journalctl --disk-usage
Archived and active journals take up 80.0M in the file system.
journalctl --list-boots
#lists boots from months ago
How do I actually trim my journal entries to just 4 days ago? (4 days is arbitrary)
Thanks in advance.
Edited 30 Mar 2017. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 5 · 100% up
- Kind
- Text
- ID
- 62gesf
4 comments
odd. should work as you're doing it.
assuming you got output the first time on
--vacuum-time.file + sizes in
/var/log/journal/2cfd9dec960b4861aecb88a76fc32810shed some light? or do you have any wierd journald.conf settings?vacuum won't destroy the active journal, so if that extends beyond $time, you will have that stuff - but that would be wierd anyway, because the active journal shouldnt go back too far, and even so 80MB for all the way back to june 2016 is pretty skimpy.
UPDATE moved the user-1000* files and now journalctl reports from March 23 to March 30, which is good enough for me. Of course, it's still not just 4 days...
Here's the files in the journal directory 2cf...
total 81M
Do those files look something like yours?
I've never modified it and every line is commented out as I believe it is using defaults.
Would you be willing to try to vacuum some lines to see if that works for you as expected?
Thanks
yup, works, even tried 1m on my desktop - removed all but active journals (about a days worth in my case).
that all looks fine - just your active journals(as they stretch back to the 23), vacuum wont touch them.
it's still strange that --- ooo you know what, maybe. maybe one of those users doesn't login often? and their active journal could go all the way back to june2016. and why moving those journal file 'fixed' the issue.