Apache log can contain several line of error. Counting the occurrence of each error is a good way to start.
Apache log separate field with "[ ]". Using sort for sorting error and uniq with -c option to count the number of occurrence.
Here to list all in error regardless of warning or error :
awk -F'[\[\]]+' '{print $7}' error.log | sort | uniq -c | sort -nr
To filter for error add the logic to awk :
awk -F'[\[\]]+' '$4 == "error"{print $7}' error.log | sort | uniq -c | sort -nr
ไม่มีความคิดเห็น:
แสดงความคิดเห็น