Networker

Re: [Networker] Truncating Logfiles...

2002-11-22 14:39:46
Subject: Re: [Networker] Truncating Logfiles...
From: "Engle, Vic" <ENGLE005 AT ONYX.DCRI.DUKE DOT EDU>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Fri, 22 Nov 2002 14:39:03 -0500
I use this script to roll the log daily and a crontab entry to remove old
log files. The server is an E250, Solaris2.6.

Vic


Crontab  entry
# Rotate and compress the daemon logs
30 17 * * * /opt/local/sbin/nsr/rotate_log.pl  >> /dev/null 2>&1
40 17 * * * /usr/bin/find /nsr/logs -mtime +30 -exec rm {} \;


Script - /opt/local/sbin/nsr/rotate_log.pl
#!/opt/local/bin/perl -w

$GZIP = "/opt/local/bin/gzip";
$LOGDIR = "/nsr/logs";
$LOG = "daemon";

$date = GetDateString();
$newlog = $LOGDIR . '/' . $date . '.' . $LOG . ".log";
$log = $LOGDIR . '/' . $LOG . '.log';

system("/usr/bin/cp $log $newlog");

if ( -e "$newlog" ) {
        system("/usr/bin/cat /dev/null > $log");
        system("$GZIP $newlog");
}

for ($i=0;$i<10;++$i) {
        $LOGS = "$LOGDIR/$LOG" . '.00' . $i;
        system("$GZIP $LOGS") if ( -e "$LOGS");
}

sub GetDateString {

        my ($Day, $Month, $Year)=(localtime)[3,4,5];
        $Year+=1900;
        #$Year=substr($Year, -2);
        $Month+=1;
        $Month="0" . "$Month";
        $Month=substr($Month, -2);
        $Day="0" . "$Day";
        $Day=substr($Day, -2);
        my $DateString=     "$Year" . "$Month" . "$Day";
        return $DateString;
}



> ----------
> From:         Peacock, Tom[SMTP:TPeacock AT DETMA DOT ORG]
> Reply To:     Legato NetWorker discussion;Peacock, Tom
> Sent:         Friday, November 22, 2002 2:27 PM
> To:   NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject:      Re: [Networker] Truncating Logfiles...
>
> ...or bouncing NetWorker daemons/services.
>
> -----Original Message-----
> From: Rohrich, James [mailto:rohrich AT UOP DOT COM]
> Sent: Friday, November 22, 2002 1:26 PM
> To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject: Re: [Networker] Truncating Logfiles...
>
>
> About the only time I have seen it do this on the Unix platform is after a
> reboot.
>
> -----Original Message-----
> From: Fowler, Carter [mailto:CFowler AT CITY.LONDON.ON DOT CA]
> Sent: Friday, November 22, 2002 12:15 PM
> To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject: Re: [Networker] Truncating Logfiles...
>
>
> That's fantastic, but that's quite clear. :)
> What I'm curious to know is what criteria NetWorker uses to determine when
> to truncate the daemon.log file.
>
> Thanks again,
>
> Carter Fowler
> Hardware Service Technician
> The City Of London
> 380 Wellington St. Suite 600
> London, ON, CA, N6A 5B5
> Off. 519.661.5711
> Cel. 519.870.4956
> E-mail. cfowler AT london DOT ca
>
>
> -----Original Message-----
> From: lemons_terry AT EMC DOT COM
> Sent: November 22, 2002 1:09 PM
> To: lemons_terry AT EMC DOT COM; NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject: Re: Truncating Logfiles...
>
> Hi Carter
>
> NetWorker will create a new, empty daemon.log file, after renaming the old
> one to 'daemon.nnn', where 'nnn' is a number.  The higher the number, the
> older the log file.
>
> tl
>
> -----Original Message-----
> From: Fowler, Carter [mailto:CFowler AT CITY.LONDON.ON DOT CA]
> Sent: Friday, November 22, 2002 12:59 PM
> To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
> Subject: [Networker] Truncating Logfiles...
>
>
> Platform: Win2K
> Software: NetWorker 6.1.1 Build 238
>
> The daemon.log file appears to truncate of it's own accord.
> Just wondering if anyone can tell me how NetWorker decides to truncate a
> logfile.
>
> TIA,
>
> Carter Fowler
> Hardware Service Technician
> The City Of London
> 380 Wellington St. Suite 600
> London, ON, CA, N6A 5B5
> Off. 519.661.5711
> Cel. 519.870.4956
> E-mail. cfowler AT london DOT ca
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>

--
Note: To sign off this list, send a "signoff" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=