To rotate your IBM HTTP Server logs (or Apache HTTP server logs) on a daily (or whatever) basis, you normally are using something like
1 |
CommonLog "|/opt/IBM/HTTPServer/bin/rotatelog -l /opt/IBM/HTTPServer/log/access_log.%Y.%m.%d 5M" common |
The disadvantage of that is, that the current log file name changes every day. So if you have e.g. a log viewer open to watch the log file, you need to adapt that file name every day.
A better solution for that is a tool called “cronolog“. It can be used in a similar way like
1 |
CommonLog "|/usr/sbin/cronolog /opt/IBM/HTTPServer/logs/%Y-%m-%d/access_log -S /app/HTTPServer/logs/access_log -P /app/HTTPServer/logs/access_log_before" common |
It then creates a directory with the date as the name and places the log file of that day inside that directory. In addition it creates a symbolic link with the original name (“access_log”) and also a symbolic name to the log file of the day before (“access_log_before”).
Both file names will not change and therefore can be monitored without changing anything in the log viewer.
The tool should be part of all Linux distributions and can be installed e.g. with “yum -y install cronolog” (for Redhat; use the package install command for your distribution instead).