Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 10 of 10

Thread: Log rotation?

  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    10,073

    Log rotation?

    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?

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    18,932

    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

  3. #3
    Senior Member vrobin's Avatar
    Join Date
    May 2007
    Posts
    460

    Smile

    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)

  4. #4
    Quote Originally Posted by Michael Herger View Post
    > 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
    In 7.x, with log4perl, wouldn't this offer a cross-platform solution?
    http://search.cpan.org/dist/Log-Disp.../FileRotate.pm

    -Peter
    http://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

  5. #5
    Senior 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?

  6. #6
    Senior Member snarlydwarf's Avatar
    Join Date
    Jul 2005
    Location
    Oregon
    Posts
    3,675
    Quote Originally Posted by JJZolx View Post
    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?
    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.

  7. #7
    NOT a Slim Devices Employee kdf's Avatar
    Join Date
    Apr 2005
    Posts
    9,493

    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



  8. #8
    Senior 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:
    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
    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!

    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.

  9. #9
    Senior Member
    Join Date
    Feb 2007
    Location
    Vancouver, BC
    Posts
    120
    Quote Originally Posted by quietdragon View Post
    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?
    Attached Files Attached Files

  10. #10
    Robin Bowes
    Guest

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •