Re: Rotating Log-Container

From: Date: Wed, 02 Feb 2005 21:40:37 +0000
Subject: Re: Rotating Log-Container
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35890@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Clay Loveless wrote: | On 2/2/05 3:14 AM Pacific Time, Stephan Wentz (stephan@wentz.it) wrote: | | |>I've implemented a Log-Container for Log-1.8.7 which rotates the |>logfiles based on several conditions (like filesize, number of lines, |>last modification-date). |>... |>I need this container because on our managed server I can't use external |>tools like logrotate to maintain the logfiles, which grow large very fast... | | | Hi Stephan, | | I've been following this thread, and so far I haven't seen a mention of why | exactly the log files need to be rotated, other than the fact that they | become very large very quickly. | | If the goal is to have a collection of log files that are somewhat | manageable in size, why can't you just dynamically specify logfile names | based on windows of time? Hourly logs as "logfile_%m%d%Y_%H.log", for | example. | | If logs-by-the-hour are still too large, come up with a little routine that | segments an hour into 15 minute chunks, and determines which chunk the | current minute is in, and determines the appropriate logfile name based on | that. | | Wouldn't that solve the problem -- manageable log file sizes without any | system calls, line counting or race conditions? | | -Clay | Yea, that would be a solution, but I like logrotate's idea of having a "current"-logfile, while the older logfiles are moved "away" from the current file. But of course you're right that this would solve the race-condition. Like stated in my other mails I will stick with the logrotater, without system calls, maybe just with a maximum age-check, this has no expensive calls and the chances for a race are exactly like with an external tool, but I'm still having a current-file. Stephan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCAUjV8qQ9XV7tBNQRAucIAKD9XCH65XEXo95UEW3wDxgf53t89wCgst0k 7fKIF+H7GcBkDH04af6qkFA= =CS0J -----END PGP SIGNATURE-----

« previous php.pear.dev (#35890) next »