Search code examples
loggingcompressionglassfisharchive

Glassfish server.log compression and archiving


I'm looking for a simple solution for the following problem.

  • We have some glassfish server.log files that are getting quite large (about 700mb per day) for a high traffic web application. We need to retain the logs for an indeterminate (long!) amount of time.
  • I need a simple way to archive the logs at the end of each (day? week? etc) into a zip file or something similar.

Can this be done via Glassfish itself? Or do I need to write a batch/powershell script to do it for me, and scheduler it on the server?

Cheers, Chris


Solution

  • Glassfish can manage the number of files to retain in the domain/logs directory but does not manage compression and archival. I would recommend a shell script (if using a *NIX OS) using gzip to compress and generate your zip file that is scheduled using cron.