Counting the HTTP 500 error per minute
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.
Praveen.
|