Configure native Gerrit log rotation and cleanup

Prior to Gerrit 3.10 Gerrit would automatically rotate and compress log
files; however, it would not delete them. With Gerrit 3.10 you can now
configure a time to keep value for rotated log files and Gerrit will
delete files older than the keep value.

Explicitly configure log compression and rotation to true (these are
the defaults but being explicit here makes sense to me if setting time
to keep) and add a 30 day timeToKeep value. This matches our current
Gerrit log pruning cronjob retention period of 30 days. Landing this
under Gerrit 3.9 should be safe then when we upgrade to 3.10 we can
remove our cronjob and rely on Gerrit to do this for us.

Note that cleanup happens in Gerrit at midnight and our cronjob runs at
0600. These should be separated by enough time that we can safely have
both running after the upgrade.

Change-Id: I4219e48c1fab5da97f80130d45badb759af680a1
This commit is contained in:
Clark Boylan 2024-11-04 10:31:17 -08:00
parent 689b14e6da
commit 8938136179
2 changed files with 6 additions and 0 deletions

View File

@ -349,6 +349,8 @@
# Gerrit rotates their own logs, but doesn't clean them out
# Delete logs older than a month
# TODO set state to absent then remove entirely after we upgrade to
# Gerrit 3.10 and set log.timeToKeep to do this rotation natively.
- name: Set up cron job to clean old gerrit logs
cron:
name: clear-gerrit-logs

View File

@ -42,6 +42,10 @@
javaHome = /usr/lib/jvm/java-17-openjdk-amd64
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
[log]
rotate = true
compress = true
timeToKeep = 30d
[gc]
[core]
packedGitOpenFiles = {{ gerrit_packed_git_open_files }}