alex_fatu has asked for the wisdom of the Perl Monks concerning the following question:
hi there, monks!
i am new to Perl.
i am a Java, C/C++/C# programmer, recently i also administrate some servers and i need to make a log parser.
let's say my logs size its aprox 2Go. after some test of parsing a simple text i have the next results:
soft powergrep(windows7) - aprox 5 mins
powershell script made by me (new to powershell also) - aprox 5 min
Perl script - aprox 1 min (maximum) - i think..if i will use regexp it will go to 40 sec..maybe.. (today is the first day using Perl, Powershell, scripts)
what i need from this script. Let's say that my log have errors..like DB error ORA-xxxx etc. If i find ORA-xxxx ..maybe print this in a new log and ..the most important: send an e-mail and a text message on my phone.
I need some ideas, please..best practices..i'm sure that i'm not the only one who needs this script.. maybe one of you have something like this...
any info is very useful
btw..this is the script with 1 min search result:
i am new to Perl.
i am a Java, C/C++/C# programmer, recently i also administrate some servers and i need to make a log parser.
let's say my logs size its aprox 2Go. after some test of parsing a simple text i have the next results:
soft powergrep(windows7) - aprox 5 mins
powershell script made by me (new to powershell also) - aprox 5 min
Perl script - aprox 1 min (maximum) - i think..if i will use regexp it will go to 40 sec..maybe.. (today is the first day using Perl, Powershell, scripts)
what i need from this script. Let's say that my log have errors..like DB error ORA-xxxx etc. If i find ORA-xxxx ..maybe print this in a new log and ..the most important: send an e-mail and a text message on my phone.
I need some ideas, please..best practices..i'm sure that i'm not the only one who needs this script.. maybe one of you have something like this...
any info is very useful
btw..this is the script with 1 min search result:
#!/usr/bin/perl -w use strict; use IO::File; use constant FILE => 'D:\ps-scripts\DirectX.log'; use constant FIND => 'eroare'; IO::File->input_record_separator(FIND); my $fh = IO::File->new(FILE, O_RDONLY) or die 'Could not open file ', FILE, ": $!"; $fh->getline; #fast forward to the first match #print each occurence in the file print IO::File->input_record_separator while $fh->getline; $fh->close;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: log parser
by Anonymous Monk on Jun 17, 2013 at 07:50 UTC | |
by Happy-the-monk (Canon) on Jun 17, 2013 at 07:57 UTC | |
by Anonymous Monk on Jun 17, 2013 at 08:35 UTC | |
by pklausner (Scribe) on Jun 17, 2013 at 14:21 UTC | |
by alex_fatu (Novice) on Jun 17, 2013 at 08:09 UTC | |
by Anonymous Monk on Jun 17, 2013 at 08:41 UTC | |
by alex_fatu (Novice) on Jun 17, 2013 at 08:48 UTC | |
by perlfan (Vicar) on Jun 17, 2013 at 10:52 UTC | |
Re: log parser
by ultibuzz (Monk) on Jun 17, 2013 at 09:05 UTC | |
Re: log parser
by alex_fatu (Novice) on Jun 17, 2013 at 10:06 UTC | |
by ultibuzz (Monk) on Jun 17, 2013 at 10:50 UTC | |
by alex_fatu (Novice) on Jun 17, 2013 at 10:53 UTC | |
by alex_fatu (Novice) on Jun 17, 2013 at 10:50 UTC | |
by hdb (Monsignor) on Jun 17, 2013 at 10:59 UTC | |
by 2teez (Vicar) on Jun 17, 2013 at 11:04 UTC | |
by Anonymous Monk on Jun 17, 2013 at 10:59 UTC | |
Re: log parser
by pklausner (Scribe) on Jun 17, 2013 at 14:40 UTC | |
Re: log parser
by alex_fatu (Novice) on Jun 17, 2013 at 12:51 UTC | |
by ultibuzz (Monk) on Jun 17, 2013 at 15:09 UTC | |
by FloydATC (Deacon) on Jun 17, 2013 at 15:50 UTC |
Back to
Seekers of Perl Wisdom