HI, folks I am under NT and my problem is that my file cygwin_syslog.txt is 
always growing with the same informations that is boring.If I append with 
open(LOGFILE >...) the file is always destroyed and I have only one information 
and I want the whole logs informations I want to use open(LOGFILE >>...)






I have this code :
open (READ,"$_Globals{TIME}")or die "Can't open READ: $!\n";
        $timewritten = <READ>;
        close (READ) or die "Can't close READ: $!\n";

        $x = 0;
        
        $handle=Win32::EventLog->new("Application")
        or die "Can't open Application EventLog\n";
        $handle->GetNumber($recs)
        or die "Can't get number of EventLog records\n";
        print "No. of records = $recs\n";
        $handle->GetOldest($base)
        or die "Can't get number of oldest EventLog record\n";
        print "Oldest record is record no. $base\n";


        #POur écrire à la suite du fichier les infos de log mais bug fait 
grandir le fichier 

        # To append:
        open (LOGFILE,">>C:\\cygwin_syslog.txt") or die "Can't open LOGFILE: 
$!\n";

        # Or to overwrite (in which case you don't have to create the file).
        #mais détruit les infos ultérieures génants.

        #open (LOGFILE,">$_Globals{SYSLOG}") or die "Can't open LOGFILE: $!\n";
        my $time;
        foreach (0 .. $recs - 1) {
        $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
                                  $base + $_,
                                  $hashRef)
                or die "Can't read EventLog entry #$x\n";

        my %deref;
        %deref = %$hashRef;

        # Next line is new #####
        next if ($timewritten > $deref{TimeGenerated});

        foreach (qw{Cygwin dhcpd ftpd}) {
            if ($deref{Source} eq $_) {
                print LOGFILE "$deref{TimeGenerated}: $deref{Strings} ($_)\n";
            }
        }

        # Next 2 lines are new #####
        $time = $deref{TimeGenerated} if ($time < $deref{TimeGenerated});
                                                        
        
        }

        close (LOGFILE) or die "Can't close LOGFILE: $!\n";

        # Next 3 lines are new #####
        open (WRITE, ">$_Globals{TIME}") or die "Can't open WRITE: $!\n";
        print WRITE $time;
        close (WRITE) or die "Can't close WRITE: $!\n";
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
1001423509:44CGMB0114.col.bsf.alcatel.fr: read request for /bootp/cygwin.bat: success
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to