I have a virtual host, which creates the following access.log:
CustomLog /home/rimmer/dev/fdom/logs/access.log fdom
What I want to do, however, is have it split the log to 5 minute increments and move every old log to /home/rimmer/dev/fdom/logs/complete/access.log-identifier_to_avoid_duplicity
How can I do this? I think I need to use rotatelogs
, but I'm not exactly sure how.
EDIT: To clarify, I want the logs to be like this:
/logs/complete/access.log-17:00-17:05
/logs/complete/access.log-17:05-17:10
/logs/complete/access.log-17:10-17:15
While the current log, which is being logged, because the 5 minute increment isn't over yet will be the normal log:
/logs/access.log
You should try with cronolog . It's an external tool. On a debian install it is available vith a simple apt-get.
You would end up with something like that (the pipe | is very important):
CustomLog "|/usr/sbin/cronolog --period='5 minutes' /home/rimmer/dev/fdom/logs/complete/%Y/%m/%d/access.log-%H-%M.log"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.