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:
use constant FILE => 'D:\ps-scripts\DirectX.log';
use constant FIND => 'eroare';
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||