I just noticed this comment about weekly rotation of SlimServer logs:
http://bugs.slimdevices.com/show_bug.cgi?id=5073#c2
Is this a Linux only thing? If so, are there obstacles that prevent the same from being done on Windows systems?
Results 1 to 10 of 10
Thread: Log rotation?
-
2007-06-21, 16:24 #1Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Log rotation?
-
2007-06-21, 23:33 #2
Log rotation?
> Is this a Linux only thing? If so, are there obstacles that prevent
> the same from being done on Windows systems?
The main obstacle is that Windows doesn't know log rotation. On most
Linux/Unix system it's a standard service. You'd have to install it on
Windows yourself (I'm sure there are tools doing this).
Michael
-
2007-06-22, 09:15 #3
Log rotation is needless with windows as you have to format your hard drive every sixth months...
(sorry, I've never been strong not to give in to the temptation)
-
2007-06-22, 09:34 #4Senior Member
- Join Date
- Oct 2005
- Posts
- 2,769
In 7.x, with log4perl, wouldn't this offer a cross-platform solution?
http://search.cpan.org/dist/Log-Disp.../FileRotate.pm
-Peterhttp://www.tux.org/~peterw/
Note: The best way to reach me is email or PM, as I don't spend time on the forums.
Free plugins: AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu DenonSerial
FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
SettingsManager SleepFade StatusFirst SyncOptions VolumeLock
-
2007-06-22, 10:19 #5Senior Member
- Join Date
- Apr 2005
- Location
- Colorado
- Posts
- 10,073
Yeah, I'd love to see this for Windows as well.
I'm not sure I quite understand how you can have an outside process rotating the logs of your application. For instance, if the application buffers log writes (say every minute, or every 20 events, or every 32kB, etc.) how do you make sure that all entries have been flushed (to the correct log by time period) before the log is rotated?
-
2007-06-22, 10:32 #6
On Unix it's not very difficult:
1) mv logfile logfile.0
note that on a unix system, any process that opened "logfile" before this point will now hold an open handle to "logfile.0" instead.
2) send signal (usually HUP) to logger (syslog usually, but sometimes its the program like with apache) to close/reopen logs.
3) gzip logfile.0
The time period isn't considered precise with Unix systems... since logrotate is usually one process that handles rotation of several programs, relying on it to rotate at precisely 06:30 for each of them is impossible. (Especially since stock Unix makes no attempt at being "real time"). Log rotation typically happens once/day (or week, month, depending on the growth of the file) and is scheduled with cron.
-
2007-06-22, 10:38 #7
Log rotation?
patches welcome. There is a long list and limited resources, so there
is always room for anyone interested to make it happen.
-kdk
-
2007-10-07, 12:29 #8Senior Member
- Join Date
- Feb 2007
- Location
- Vancouver, BC
- Posts
- 120
Log rotation with multilog broken in 7.0 alpha
See http://bugs.slimdevices.com/show_bug.cgi?id=5691 for details and a proposed patch.
The original patch to allow the logfile to pipe to a process was to allow for the use of a log rotating process like multilog. See http://forums.slimdevices.com/showthread.php?t=1666 for details.
I had a brief look at Log:
ispatch::FileRotate, but the Log4Perl FAQ says:
The Log4Perl FAQ talks about using newsyslog but the appender needs some additional settings because newsyslog does not operate transparently; it will move the log file away to archive it as it rotates to the new log file!Luckily, Mark Pfeiffer's Log:
ispatch::FileRotate appender works well with Log::Log4perl to rotate your logfiles in a variety of ways.
Note, however, that having the application deal with rotating a log file is not cheap. Among other things, it requires locking the log file with every write to avoid race conditions. There are good reasons to use external rotators like newsyslog instead
Thus I find the approach presented by multilog preferable because it provides a good means to achieve log rotation in a light weight and transparent way.
-
2007-10-11, 19:47 #9Senior Member
- Join Date
- Feb 2007
- Location
- Vancouver, BC
- Posts
- 120
-
2007-10-12, 00:11 #10Robin BowesGuest
Log rotation?
quietdragon wrote:
> quietdragon;233351 Wrote:
>> See http://bugs.slimdevices.com/show_bug.cgi?id=5691 for details and a
>> proposed patch.
>>
>
> What's the procedure for submitting this patch to the v7.0a branch?
>
>
> +-------------------------------------------------------------------+
> |Filename: Log.pm.diff |
> |Download: http://forums.slimdevices.com/attachment.php?attachmentid=3540|
> +-------------------------------------------------------------------+
>
As the person who did the original log-to-pipe work, it has niggled me
for a while that it doesn't work right in 7.x, although obviously not
enough to do anything about it
I'll try and make time to look at your patch.
R.

Reply With Quote

