At work one of our clients (we host websites among other things) requested that their traffic be piped into separate access logs and made available for download so that they could run traffic analysis on them and whatnot. This was easy, I just pointed the logs to a new file in their apache virtual host directive and all was happy.

What's not happy is that their logs are now about 87 meg, and growing. They obviously aren't to thrilled about downloading that size of a log. What they've requested is a rotating log limited at say 10MB. Now I can easily write a bash script to rotate the log file completely (move the existing one and start a new one) and invoke it with cron, but what they'd prefer, if possible, is to have a FIFO type log.

The way I envision this working is to set a line count limit on the log file, then once it's full, each new line of input pushes the oldest line off the end, into the great bit bucket in the sky.

Is there a way to setup a file in this manner directly? All sorts of magic is possible in *nix, so I thought I'd ask. If not, what's an efficient way of doing this with a script? Or should I just give them five 2MB rotating logs, so they always have at least 8MB available to them?

Jacob Fugal


____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to