p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Beginning Shell Scripting ISBN: 0-7645-8320-4 (http://p2p.wrox.com/book-beginning-shell-scripting-isbn-0-7645-8320-4-175/)
-   -   Counting the HTTP 500 error per minute via shell scripting (http://p2p.wrox.com/book-beginning-shell-scripting-isbn-0-7645-8320-4/78306-counting-http-500-error-per-minute-via-shell-scripting.html)

spraveenitpro February 23rd, 2010 02:59 AM

Counting the HTTP 500 error per minute via shell scripting
 
Hi

I am trying to write a script to count and record the number of http 500 errors per minute upon parsing the httpd.conf ,

I have written 2 scripts for this :
1.
# Script to catch Http 500 Errors in a separate file

tail -500 access_log |awk '$9 == 500 {print $9}' >>/tmp/500.log

2.

# Script to Monitor for Http 500 Error Build up

Conn_Threshold=50 #Set Threshold value
count=`wc -l /tmp/500.log` #Count the NUmber of 500s
val=`grep -c 500 /tmp/500.log` #Assign the value to a variable
echo $val

#If threshold value exceeds the limit then page the Analyst
if [ "${val}" -ge "${Conn_Threshold}" ];

then echo "The Http 500 Counted exceeded 50 , please check the logs"
echo '' >500.log #Reset the Counter
fi

This doesnt seem to work as I am not able to capture the number of http 500's for the last one minute. any help here would be great.

Pravee


All times are GMT -4. The time now is 04:47 AM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.