heres a bit of perly parsing for access log, pipe it to the stdin
hope it helps to get you started to do what you want.
my %trDLRs;
$countMT=0;
$countMO=0;
$countDLRs=0;
while($line = <STDIN>)
{
$linenum++;
chop($line);
if( $line =~ /Sent SMS/)
{
$countMT++;
}
if( $line =~ /Receive SMS/)
{
$countMO++;
}
if( $line =~ /DLR SMS/ )
{
$countDLRs++;
@args = split(/\[/,$line);
$i=0;
$dlrinfo= 0;
$tid = 0;
foreach $ar (@args)
{
$args[$i] =~ s/\]//;
# print "'".$args[$i]."'\n";
if ($ar =~ /flags/) {
@fields = split(/:/,$ar);
$fields[5] =~ s/[ \t]//;
if($fields[5] =~ /x.*/) {
$dlrinfo = oct($fields[5]);
}
else {
$dlrinfo = int($fields[5]);
}
}
if ($ar =~ /tid/) {
@fields = split(/:/,$ar);
$fields[1] =~ s/[ \t]//;
$tid = int( $fields[1]);
}
$i++;
}
if ($DEBUG) {print "tid=".$tid.",dlr=".$dlrinfo."\n";}
if (exists($trDLRs{$tid}))
{
$trDLRs{$tid} = $trDLRs{$tid} | $dlrinfo;
}
else
{
$trDLRs{$tid} = $dlrinfo;
}
}
}
----- Original Message -----
From: Divyesh Amipara
To: [email protected]
Sent: Wednesday, August 30, 2006 7:32 PM
Subject: Kannel Log Parser
Dear all,
Please if any one has kannel log parser written in perl or C, share it.
Will appreciate.
Thanks,
>> Divyesh A.