in reply to Re^3: Undefined Error
in thread Undefined Error

I took the prod log, an hour log is of 200 MBs. Is that low/high?

To be on safer side, I would like to dump the search onto the disk, and then perform the searches ( ie bind etc)

what do you suggest?

Replies are listed 'Best First'.
Re^5: Undefined Error
by poj (Abbot) on Jun 18, 2013 at 16:05 UTC

    Not quite sure what you mean but assuming you have a number of logs all in one folder, then this script will scan them and extract only the records you are interested in into a single file which you can process with the 'bad user' script.

    #!perl use strict; # start time my $t0 = time(); # input - create list of files my @files = grep { /.log/ } glob("*") ; # output my $count_out = 0; my $outfile = 'output.log'; open OUT,'>',$outfile or die "Could not open $outfile : $!"; # process for my $infile (@files){ next if ($infile eq $outfile); open IN,'<',$infile or die "Could not open $infile : $!"; print "Reading $infile .. "; my $count_in = 0; while (<IN>){ ++$count_in; if (/BIND|SRCH=Q/){ print OUT; ++$count_out; } } close IN; print "$count_in records read\n"; } # finish close OUT; my $dur = time() - $t0; print "Finished in $dur secs \n $count_out written to $outfile\n";
    poj
Re^5: Undefined Error
by johnrein55 (Novice) on Jun 19, 2013 at 15:10 UTC
    Thanks Poj.

    Actually, my intent is to dump the content of hash into disk instead of memory. Anyway, I will try to utilize the provide script. However, can you put hourly logic into this as you had before?