Openhab saves only one log as openhab.log.1.gz

There is a only one old log stored in openhab.log.1.gz before last restart.

How to ensure that there are more logs stored beyond only last restart.

E.g. if the system is getting started daily in morning. Is it possible to collect openhab.log and event.log for all thirty days?

If not, how to enable getting data for all thirty days in which the system will be shut down daily in evening.

Thanks in advance.

You shouldn’t be shutting it down, OH is designed to run 24/7.

Either way, logging has nothing to do with neither restarts nor runtime in the first place
(well unless you happen to use some ramdisk mechanism like zram for logs.
You didn’t tell us, though.)

Log storage/rotation is not time based so making it 30 days isn’t really possible but you can edit log4j2.xml to define the size and number of logs to store, see

Hello mstormi. Thanks a lot for quick responce.

This is a demo hardware running openhab in one light showroom. The owner tend to switch off everything while closing the showroom. The log need not be time limited to 30 days. 30 days is just an example.

Because it is not retained, I am not able to retrieve any information about it’s usage or any problems that he might have faced.

Today i can see one file which shows events for today and one file name openhab.log.1.gz. On extracting it, I am able to see events for yesteday.

However, beyond last restart it is flushing the data.

I want it not to flush older data.

I am not sure, which line in log4j2.xml would help me do so.

As I already said openhab doesn’t flush old logs by default.
So what you see probably happens because you do use some kind of ramdisk for the logdir and/or the box is not properly shut down.
That now obviously is not the most clever setup in combination with daily shutdowns so either of these habits you will need to change.
What’s the hardware and OS setup?

Orange Pi Zero 2 with Armbian.

Armbian AFAIK uses ZRAM and a read-only OS. Not a clever choice for your application.