its not working...anyways thanks
my exact problem is that i hav a log file file and i need to monitor the log file,it has lines like...
Code:
19 Mar 01:01:17:845 [Servlet.Engine.Transports : 3] AUDIT event.platform.interactionCompleted - name=,duration=9247 (IID=0003080248636880, TID=0030000248650301, CAPPID=000C0546517C)
here i have to extract the duration value i.e 9247 and compare it with a timeout threshold value,if it is greater than that value,count all such lines.
then find out a ratio of time out counts to count of total interactions.i wrote a script like
Code:
TRNSthreshold=5000
nawk -v v1=$TRNSthreshold '/interactionCompleted/ {var1=$10
if ((x=(index(var1,","))) > 0)
{
time=(substr(var1,x+1,length(var1)))
if((y=(index(time,"="))) > 0)
{
t=0+(substr(time,y+1,length(time)))
}
}
if (t > v1)
{
print "duration greater than threshold value: " t
count=count+1
print "count of interactions timed out " count
}
}' 0003080248636880.txt
m=`grep -c "interaction Completed" 0003080248636880.txt`
echo "total count of interactions" $m
s=`expr $count / $m`
echo "ratio is " $s
my problem is i am nt able to access the value of count outside the awk block.
please help me.thanks in advance