Skip to content

Commit

Permalink
[DPE-4297] Introduce retention (#42)
Browse files Browse the repository at this point in the history
* [DPE-4297] Enable automatic sys logs cleanup and retention

* switch to size based rotation

---------

Co-authored-by: Enrico Deusebio <[email protected]>
  • Loading branch information
zmraul and deusebio authored May 27, 2024
1 parent a2ede5b commit 7f3ec48
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions snap/local/etc/kafka/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,46 +1,60 @@
charmed.kafka.log.level=INFO
charmed.kafka.log.maxfilesize=100MB
charmed.kafka.log.retention=10

log4j.rootLogger=${charmed.kafka.log.level}, kafkaAppender

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n

log4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.kafkaAppender=org.apache.log4j.RollingFileAppender
log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.kafkaAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.kafkaAppender.MaxBackupIndex=${charmed.kafka.log.retention}

log4j.appender.stateChangeAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.stateChangeAppender=org.apache.log4j.RollingFileAppender
log4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log
log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.stateChangeAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.stateChangeAppender.MaxBackupIndex=${charmed.kafka.log.retention}

log4j.appender.requestAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.requestAppender=org.apache.log4j.RollingFileAppender
log4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log
log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.requestAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.requestAppender.MaxBackupIndex=${charmed.kafka.log.retention}

log4j.appender.cleanerAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.cleanerAppender=org.apache.log4j.RollingFileAppender
log4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log
log4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.cleanerAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.cleanerAppender.MaxBackupIndex=${charmed.kafka.log.retention}

log4j.appender.controllerAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.controllerAppender=org.apache.log4j.RollingFileAppender
log4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log
log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.controllerAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.controllerAppender.MaxBackupIndex=${charmed.kafka.log.retention}

log4j.appender.authorizerAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.authorizerAppender=org.apache.log4j.RollingFileAppender
log4j.appender.authorizerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.authorizerAppender.File=${kafka.logs.dir}/kafka-authorizer.log
log4j.appender.authorizerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.authorizerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.authorizerAppender.MaxFileSize=${charmed.kafka.log.maxfilesize}
log4j.appender.authorizerAppender.MaxBackupIndex=${charmed.kafka.log.retention}

# Change the line below to adjust ZK client logging
log4j.logger.org.apache.zookeeper=${charmed.kafka.log.level}
Expand Down

0 comments on commit 7f3ec48

Please sign in to comment.