2006-02-04

一个轮循日志的工具

cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file
specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened.

cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs. For example the Apache configuration directives:


TransferLog "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/access.log"ErrorLog    "|/usr/sbin/cronolog /web/logs/%Y/%m/%d/errors.log"


would instruct Apache to pipe its access and error log messages
into separate copies of cronolog, which would create new log
files each day in a directory hierarchy structured by date,
i.e. on 31 December 2002 messages would be written to

/web/logs/2002/12/31/access.log/web/logs/2002/12/31/errors.log


after midnight the files

/web/logs/2003/01/01/access.log/web/logs/2003/01/01/errors.log


would be used, with the directories 2003, 2003/01 and 2003/01/01
being created if they did not already exist.

More detail to come...

没有评论:

发表评论