I'm looking for a simple solution for the following problem.
- We have some glassfish server.log files that are getting qu开发者_开发技巧ite 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
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.
You gotta write a script. We have the same issue.
You could try using collect-log-files:
/path/to/glassfish/asadmin collect-log-files
This command will create a .zip file containing all logs from
/path/to/glassfish/.../domain/logs/
and as default store it in directory
/path/to/glassfish/.../domain/collected-logs/
精彩评论