[IRCServices] Rotate Log function - performance

Ian R. Justman ianj at esper.net
Sat Mar 3 02:50:03 PST 2001


On Mon, 26 Feb 2001, Mark Hetherington wrote:

> I am considering adding a rotate log function to services (and to the ircd
> but that is beyond the scope of this list) which will automatically rotate
> the log each day at Midnight but am looking for a low/no performance impact
> determination that Midnight has occured.
> 
> The daylight build used to have an isMidnight function called in the "main
> loop" but this rarely succeeded  I guess because if Services happened to be
> idle or very busy at this time, Midnight passed before the isMidnight
> function activated.
> 
> Eggdrop has a number of settings for automatic log rotation and after
> investigation it uses
> 
>   add_hook(HOOK_SECONDLY, (Function) core_secondly);
> 
> with the per second function checking for Midnight among other things.
> 
> Having not used this system before I wonder as to what impact on performance
> this may have on services. If anyone knows much about using per second
> routines or what impact it might have on services it would be much
> appreciated.

As has been suggested, use SIGUSR2.  Then let Cron deal with the "per
second" dickering to call a Perl/Python/Script/whatever script you may
write deal with the actual rotating.

As for precision, does the phrase, "Measure with a micrometer, mark with
chalk, cut with an axe" mean anything to you?  I don't know about you, but
I frankly don't much care.  Just as long as I can move logs out of the way
and keep my disk space somewhat manageable, that's all I ask.

I was the one who asked for this function.  Mainly because it's MUCH
easier to set up a cron event than to try to remember to get my butt onto
IRC and issue the rotatelog command.

In fact, many systems use this kind functionality notably with system
logs, including most Linux distros as well as FreeBSD and possibly the
other BSDs as well.  I figured something like this should be in Services
because the operating system already has tools which allow for periodic
scheduling; wny not use them? ;)  Plus it's pretty simple to whip up a
rotating script in Perl or even shell script.

Just my $.02.

--Ian R. Justman, Co-Founder and Postmaster, The EsperNet IRC Network.

-----
Ian R. Justman (NIC handle IJ12)  ianj at esper.net (Official EsperNet business)
Co-Founder and Postmaster, The EsperNet IRC Network
Server Administrator, chocobo.esper.net "IJ" on IRC

PGP key available upon request, or finger ianj at esper.net.

If this message was signed with the Postmaster's key, please finger
postmaster at esper.net for the Postmaster public key.

Type Bits/KeyID    Date       User ID
pub  1024/BAB34B69 1997/11/15 EsperNet Postmaster <postmaster at esper.net>
            Key fingerprint = 05 BD 7C B5 8E 0B FD EF  EE 47 49 C4 96 11 59 75