I'm using rotatelogs to create my daily apache logs in format host.<day>.<month>.<year>.access.log
. Now I want to gzip and move log to different directory after it's been finished. How to do that?
Update: There was a little mistake. logrotate
-> rotatelogs
Best Answer
You could use rotatelogs option -p to use a program to compress the log after the rotation. (See for reference: https://httpd.apache.org/docs/2.4/programs/rotatelogs.html)
Example:
CustomLog "|bin/rotatelogs -p '/path/to/compress.sh' -l /var/log/logfile.%Y.%m.%d 86400"
compress.sh: