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.
Incorrect. journalctl has no generic search-result deletion form.
journalctl --vacuum-time=2weeksCorrect. It vacuums archives older than two weeks.
Correct. It vacuums archives older than two weeks.
journalctl --vacuum-size=2weeksIncorrect. --vacuum-size expects a byte size, not a duration.
Incorrect. --vacuum-size expects a byte size, not a duration.
journalctl --rotate=2weeksIncorrect. --rotate archives active data and does not accept this retention duration.
Incorrect. --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
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.