Delete archived journal files older than two weeks.
Do not target the active journal.
Which command is appropriate?
journalctl --vacuum-time=2weeks removes archived journal files older than the retention period.
Detailed explanation
journalctl --since '2 weeks ago' --deleteIncorrect. journalctl has no generic search-result deletion form.
journalctl --vacuum-time=2weeksCorrect. It vacuums archives older than two weeks.
journalctl --vacuum-size=2weeksIncorrect. --vacuum-size expects a byte size, not a duration.
journalctl --rotate=2weeksIncorrect. --rotate archives active data and does not accept this retention duration.
Try it yourself
An example you can run in a temporary verification environment.
journalctl --help | grep -E -- '--vacuum-time'Expected result
ageに基づくarchive削除のhelp行Key points
- time is a retention period
- Targets archived files
- Can combine with rotation when needed
Notes
- Environment: systemd journalctl help / 削除なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Syslog facility and priority
Metadata that classifies a message source and its severity.
Journal persistence
Whether systemd journal data survives a reboot and where it is stored.
Log rotation
A process that retains, renames, compresses, or removes log generations.