hello i am working on the following script and trying to work it out
with driuex assistance
http://www.wetware.com/drieux/pbl/Sys/Admin/CiscoParser1.txt

Bellow is an extract of the log file i am trying to parse.
The lines begging with the May 10 and ends with Received Bytes
The log file is exactly like the one below,the paragraph i am interested
in is
the one that has the CallLegType 1 sentence :

%VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1,
This is the one that has the number,setup time and disconnect time


May 10 15:03:05 200.73.182.8 13311: %VOIPAAA-5-VOIP_CALL_HISTORY:
CallLegType 1, ConnectionId 0 0 0 0, SetupTime 18:09:04.262 UTC Fri May
10 2002, PeerAddress 38#5347631, PeerSubAddress , DisconnectCause 2F  ,
DisconnectText no resource., ConnectTime 18:09:04.262 UTC Fri May 10
2002, DisconnectTime 18:09:04.262 UTC Fri May 10 2002,CallOrigin 1,
ChargedUnits 0, InfoType 2, TransmitPackets 0, TransmitBytes 0,
ReceivePackets 0, ReceiveBytes 0
May 10 15:03:38 200.73.182.8 13312: %VOIPAAA-5-VOIP_CALL_HISTORY:
CallLegType 2, ConnectionId DF125DE2 637711D6 BD90A185 393856AE,
SetupTime 18:09:15.110 UTC Fri May 10 2002, PeerAddress , PeerSubAddress
, DisconnectCause 10  , DisconnectText normal call clearing.,
ConnectTime 18:09:37.970 UTC Fri May 10 2002, DisconnectTime
18:09:37.970 UTC Fri May 10 2002, CallOrigin 2, ChargedUnits 0, InfoType
2, TransmitPackets 451, TransmitBytes 18040,
ReceivePackets 0, ReceiveBytes 0
......


The problem that i have found is that the program  gets into the if
statment but it does not
makes any diference(I think..).I put some prints on just to see how far
the script goes:


 if (m/$find/) {
         print "NONONO!";
        push(@log_grot , join(" ",)) ;  -->> Missing $1,$2,$3
        print "CHECKING!";
 } else {
       print "YESYESYES!"; print "not Found. $_\n" ;
    }

And it gives out the same ouput,so it seems that it always goes directly
into the else..
it does "print Not Found $_" and  prints the following output:
It gives the same output with or without the $1,$2,$3

Any ideas?
Thanks again
Hernan

YESYESYES!not Found. May 10 15:03:39 200.73.182.8 13313:
%VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1, ConnectionId DF125DE2
637711D6

YESYESYES!not Found.  BD90A185 393856AE, SetupTime 18:09:15.108 UTC Fri
May 10 2002, PeerAddress 38#537992826, PeerSubAddress , Disc

YESYESYES!not Found. onnectCause 10  , DisconnectText normal call
clearing., ConnectTime 18:09:37.978 UTC Fri May 10 2002, Disconnec

YESYESYES!not Found. tTime 18:09:37.978 UTC Fri May 10 2002, CallOrigin
1, ChargedUnits 0, InfoType 2, TransmitPackets 0, TransmitBy

YESYESYES!not Found. tes 0, ReceivePackets 451, ReceiveBytes 18040

YESYESYES!not Found. May 10 15:04:57 200.73.182.8 13314:
%VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2, ConnectionId FB286D71
637711D6

YESYESYES!not Found.  BD94A185 393856AE, SetupTime 18:10:02.088 UTC Fri
May 10 2002, PeerAddress , PeerSubAddress , DisconnectCause

YESYESYES!not Found. 10  , DisconnectText normal call clearing.,
ConnectTime 18:10:25.918 UTC Fri May 10 2002, DisconnectTime 18:10:

YESYESYES!not Found. 56.668 UTC Fri May 10 2002, CallOrigin 2,
ChargedUnits 0, InfoType 2, TransmitPackets 1238, TransmitBytes 49520

YESYESYES!not Found. , Recei
.......

-----Mensaje original-----
De: drieux [mailto:[EMAIL PROTECTED]]
Enviado el: Thursday, May 30, 2002 10:06 AM
Para: Hernan Marcelo Salvarezza
CC: cgi cgi-list
Asunto: Re: cisco log parsing



On Wednesday, May 29, 2002, at 12:29 , Hernan Marcelo Salvarezza wrote:

> Hello people
[..]
> the scripts works fine with a small log but when i try to run it in
the
> long log file it displays all the log file
> just as if it is being opened with cat.

way strange...


> I am trying to get just the number,setup time and disconnect time from
> the log,,just this values in a single
> line like this
>
> 53353454545 18:10 18:20

>> From the script
>
> my $dtgT = '\d|:|\.';   #numbers or colons or dots
> my $upT = 'SetupTime';
> my $downT = 'DisconnectTime';
> my $prefT = '38\#';
>
> my $find = qr/(.*)\s+ (\d+\.\d+\.\d+\.\d+)\s* $prefT (\d+), \s*
$upT\s*
> ([$dtgT]+)\s*$downT\s* ([$dtgT]+)/xo;

notice that there are five things being picked up


my $find = qr/(.*)\s+               # $1 - get the dtg String?
             (\d+\.\d+\.\d+\.\d+)\s* # $2 simple dotQuad Grovellor
             $prefT
             (\d+)                   # $3 = that number thing
             ,\s*                    # comma with or without spaces
             $upT\s*                 # the SetUpTime Token
             ([$dtgT]+)              # $4 - the up time
             \s*$downT\s*            # the downT Token
             ([$dtgT]+)              # $5 the down time
             /xo;                    # so that we can whack in answers.

since all you say that you want are the last three then you could
reconstruct it as


my $find = qr/\d+\.\d+\.\d+\.\d+\s* # simple dotQuad Grovellor
             $prefT
             (\d+)                   # $1 = that number thing
             ,\s*                    # comma with or without spaces
             $upT\s*                 # the SetUpTime Token
             ([$dtgT]+)              # $2 - the up time
             \s*$downT\s*            # the downT Token
             ([$dtgT]+)              # $3 the down time
             /xo;                    # so that we can whack in answers.




> so the question is  how should i form the regexp to just get the
number
> from the entire log file?
> how should i form the regexp  get only the disconnect time?
>
>
> Log File:
>
> May 10 14:25:00  13310: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1,
> ConnectionId 0 0 0 0, SetupTim
> e 17:30:58.645 UTC Fri May 10 2002, PeerAddress 38#533147631,
> PeerSubAddress , DisconnectCause 2F  , Disconnect
> Text no resource., ConnectTime 17:30:58.655 UTC Fri May 10 2002,
> DisconnectTime 17:30:58.655 UTC Fri May 10 200
> 2, CallOrigin 1, ChargedUnits 0, InfoType 2, TransmitPackets 0,
> TransmitBytes 0, ReceivePackets 0, ReceiveBytes
>  0

is that one line entry in the file???

> May 10 15:03:05  13311: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1,
> ConnectionId 0 0 0 0, SetupTim
> e 18:09:04.262 UTC Fri May 10 2002, PeerAddress 38#5347631,
> PeerSubAddress , DisconnectCause 2F  , DisconnectTe
> xt no resource., ConnectTime 18:09:04.262 UTC Fri May 10 2002,
> DisconnectTime 18:09:04.262 UTC Fri May 10 2002,
>  CallOrigin 1, ChargedUnits 0, InfoType 2, TransmitPackets 0,
> TransmitBytes 0, ReceivePackets 0, ReceiveBytes 0

and this the next line entry???

> May 10 15:03:38  %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2,
> ConnectionId DF125DE2 637711D6
>  BD90A185 393856AE, SetupTime 18:09:15.110 UTC Fri May 10 2002,
> PeerAddress , PeerSubAddress , DisconnectCause
> 10  , DisconnectText normal call clearing., ConnectTime 18:09:37.970
UTC
> Fri May 10 2002, DisconnectTime 18:09:
> 37.970 UTC Fri May 10 2002, CallOrigin 2, ChargedUnits 0, InfoType 2,
> TransmitPackets 451, TransmitBytes 18040,
>  ReceivePackets 0, ReceiveBytes 0


This is actually the interesting entry - since this one does
not have the numeric value I would be expecting given your
first two.... note also that there is no PeerAddress value set...

and does this really need to be on the cgi list? or should this
be on say the beginner's mailing list???

ciao
drieux

---



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to