Delete logs for date range
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 16.7k
- Forks
- 4.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 140
Description
Is your feature request related to a problem? Please describe.
If there are logs from "future" dates, journalctl -f and journalctl -e become rather limited in their usefulness. The "future" dates dominate over the recent logs.
I ended up in this situation due to having to test how an application would handle future dates. I would use timedatectl to disable ntp and set a date in the future, then run the application. So, even though I'm writing this on September 12, 2019, I have logs in my system for up to December 21, 2019. If I use journalctl -f, I only see logs from December 21, 2019.
The application I was testing should have had a better way to test dates to begin with. But since timedatectl gives you the power to set future dates, it would be nice if journalctl made it possible to clean things up.
See also #2738.
Describe the solution you'd like
journalctl delete-logs --since "now" -- or something of the sort. The effect would be to remove the logs in the date range from the journal.
Describe alternatives you've considered
Not getting into this situation in the first place is something I plan on doing.
Another alternative would be to remove everything, maybe with a vacuum time of 1 second. But that would mean losing past logs, which are nice to have around.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the journalctl entry point and read related issue #2738 to understand the existing discussion and constraints. The finished work should provide a defined way to remove logs within a date range without deleting unrelated historical logs, while preserving the expected journalctl behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100