rotatelogs

Thursday, 10. 20. 2005  –  Category: todo, web

I’m basically a fan of rotatelogs(1) for Apache logging: no need to gracefully restart, easy filenames to script with, encourages log ageing.

I do however find myself forever doing stuff like

$ ls -tr /a/log/dir | tail
error_log.1129593600
error_log.1129680000
error_log.1129766400 
$ tail -f error_log.1129766400
to diagnose a problem.

What would be cool was if rotatelogs linked, say, error_log.current to the, er, current log. If it used a hard link, you could probably use tail’s -F flag to seemlessly glide over rotations.

Update: I looked at the source; what immediately occurs to me is that both soft and hard linking aren’t particularly portable, and Apache runs on many different platforms. It’s probably more straightforward to do this with a shell script or similar.

Leave a Reply