Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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:

#!/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;

In reply to log parser by alex_fatu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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:
    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
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (19)
    As of 2014-09-02 14:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (25 votes), past polls