views:

156

answers:

2

Hi,

I am running JBoss 4.0.2 server and over the years it has created a large number of log files that I would like to clean up.

I would like to keep the same logging level but also have it delete any log files older than 3 months.

Is there a way to do that in the configuration or should I just write a perl script?

Thanks.

+1  A: 

Put this in a cron job:

find /var/log/jbossas/default/ -mtime +90 | xargs rm -f

See more on the unix find command

We also run the following in order to save disk space. It compresses all files who are at least 3 days old

find /var/log/jbossas/default/ -mtime +3 -name \*.log | xargs bzip2
David Rabinowitz
I looked up the command and it looks like it will solve my problem if I just make it -mtime +90.
Ben
Sorry, when I created the command I had 3 days in my mind...
David Rabinowitz
A: 

Note that the command given will remove files older than 3 days, not 3 months.

pra