Skip to content

Implement log rotation: purge >3d logs on start, clear all on update#159

Merged
PranavPurwar merged 5 commits intomasterfrom
copilot/delete-old-logs-on-update
Feb 17, 2026
Merged

Implement log rotation: purge >3d logs on start, clear all on update#159
PranavPurwar merged 5 commits intomasterfrom
copilot/delete-old-logs-on-update

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Audit logs were growing indefinitely. Now purge entries older than 3 days on app start, and clear all logs on package update.

Changes

LogUtils: Added log management functions

  • clearAllLogs() - Delete all security/audit logs
  • purgeOldLogs() - Parse timestamps, remove entries >3 days old, delete file if empty

BootReceiver: Hook package replacement

  • Added ACTION_MY_PACKAGE_REPLACED intent filter to manifest
  • Call clearAllLogs() on update (reuses existing donate link pattern)

AppLockApplication: Periodic purging

  • Call purgeOldLogs() in background thread on every app start
// On every app start
thread(start = true, name = "LogPurge") {
    LogUtils.purgeOldLogs()  // Remove entries older than 3 days
}

// On package replacement (via broadcast)
Intent.ACTION_MY_PACKAGE_REPLACED -> {
    LogUtils.clearAllLogs()  // Delete all logs
}

Log format remains unchanged: [ISO-8601 timestamp] D [TAG]: [message]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx1536M -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 17, 2026 16:29
Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
…handle empty files

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Copilot AI changed the title [WIP] Delete old security and audit logs on app update Implement log rotation: purge >3d logs on start, clear all on update Feb 17, 2026
Copilot AI requested a review from PranavPurwar February 17, 2026 16:34
@PranavPurwar PranavPurwar marked this pull request as ready for review February 17, 2026 17:01
@PranavPurwar PranavPurwar merged commit e8ac47a into master Feb 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments