feat: add django management command to purge app logs #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔍 Overview
Secret access logs, particularly reads, can get to many thousands of entries quite quickly, especially when frequently polling for secrets.
💡 Proposed Changes
Add a django management command to safely purge logs older than a specified date. This util will delete all log events older than the spcified date (30 days be default), except for create events. The command can be run in the
backend
container with:This will purge logs for all Apps in the given organisation that are older than 30 days.
Optionally, the number of days and a specific app_id can be supplied as arguments.
Purge logs for all apps older than 60 days:
Purge all logs for a specific app only
Purge logs older than 60 days for a specific app
🖼️ Screenshots or Demo
📝 Release Notes
Added a django management command to purge secret logs.
🎯 Reviewer Focus
✨ How to Test the Changes Locally
Shell into your backend container with:
And run the command
💚 Did You...
- [ ] Update dependencies and lockfiles (if required)- [ ] Regenerate graphql schema and types (if required)