Auto deletion of old log files

Hi,

My logs are rotating daily - I used this guide https://www.wowza.com/docs/how-to-configure-log-rolling-by-time-and-size -section:To roll over by time

so my log4j.properties are copy-paste from that guide and daily log rotation is working fine.

What I need more is auto delete log files, that are older than xy days.

I google it and found a solution with log4j.appender.serverAccess.MaxBackupIndex=xy

But, unfortunately, MaxBackupIndex is not working with DailyRollingFileAppender.

Is there any other solution how to achieve this (in my opinion) very basic and common log rotate functionality?

Am I really alone with that kind of requirement? How are then you handling Wowza logs?

I’m too with this problem and I don’t found any solution.

Hi!

The only solution I have found is to make a script in which I locate the log files that have the oldest days selected in a variable and remove them from the System.

With a line like this and using crontab, a Script is generated and deleted.

In this case more than 8 days old.

find -name ‘wowza_*.zip’ -type f -mtime +8 -exec rm -f {} ;

I hope it helps.

Pedro Lorenzo

Thanks for sharing that @Pedro Lorenzo.