[SOLVED] OHv2: logfile rotation daily, compression, keep 14 days

Tags: #<Tag:0x00007efed84417d0> #<Tag:0x00007efed8441640>

How do I achieve the following in OHv2:
rotate openhab and events logs based on
daily
compress
keep 14 days

I found the log config: /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg
and the relevant sections:

log4j2.appender.out.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.out.policies.size.size = 16MB

which need changing to something like TimeBasedTriggeringPolicy?!
Where can I find the possible properties?
Or what needs to be added to achieve this?

https://logging.apache.org/log4j/2.x/

Thanks… I have a crack at it… :slight_smile:

how did you go, I would like mine rotated weekly too, should I do from log4j or using logrotate on linux?

Curious to how you solved this, couldnt find much up to date info on rotating them logs. Please share :slight_smile: