[thelist] web log-file rotating

Hassan Schroeder hassan at webtuitive.com
Sat Apr 20 12:25:01 CDT 2002


Jake Aust wrote:

> I want to rotate and append the current date to the logfile instead so that
> it is clear what each file contains. I don't think it's possible to do this
> with logrotate after looking through the man pages, or am I missing
> something?

Look in the logrotate man page for "postrotate/endscript"

It allows you to run arbitrary commands after the rotate action. So
invoking a shell command like

	/bin/mv access_log.1 access_log.`date -I`

would (assuming correct path to mv, perms are correct, yadda yadda)
rename the file to access_log.2002-04-20.

(For other date formats, see the date man page.)

HTH!
--
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --



More information about the thelist mailing list