Skip to content

Instantly share code, notes, and snippets.

@renshuki
Created June 24, 2021 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renshuki/f94113ef14e1d2eeaa1fe51b6f1daeb7 to your computer and use it in GitHub Desktop.
Save renshuki/f94113ef14e1d2eeaa1fe51b6f1daeb7 to your computer and use it in GitHub Desktop.
Logstash - log4j2 logs deletion after x

e.g Delete Logstash logs after 45 days

appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.action.type = Delete
appender.rolling.strategy.action.basepath = ${sys:ls.logs}
appender.rolling.strategy.action.condition.type = IfFileName
appender.rolling.strategy.action.condition.glob = logstash-${sys:ls.log.format}-*
appender.rolling.strategy.action.condition.nested_condition.type = IfLastModified
appender.rolling.strategy.action.condition.nested_condition.age = 45D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment