-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogReviewScript
More file actions
29 lines (20 loc) · 1.16 KB
/
LogReviewScript
File metadata and controls
29 lines (20 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#group by causeby by count
grep -e "\*ERROR\*" -e "Caused by:" $LOGFILE | sort | uniq -c | sort -nr
#group by Error Type
grep -ioh "TRACE\|INFO\|ERROR\|WARN\|DEBUG" $LOGFILE | sort | uniq -c | sort -nr
#grep anomalies
grep -i -w 'fatal\|error\|exception\|timeout\|waiting\|fail\|unable\|lock\|block'
#count error span time
grep -i err LOGFILE | awk 'function prt() { if (n) printf "%s\t%s\n",pkey,n } { key=substr($0,0,2); if (key != pkey) { prt(); n=0; pkey=key } n++ } END { prt() }'
#How to grep the Server logs for the last hour (ex. find the ERROR String)
$ grep "^$(date -d '-1 hour' +'%H')" /home/jboss/server.log | grep 'ERROR'
#How to grep the Server logs for the last minutes (ex. find the ERROR String)
$ sed -n "/^$(date --date='10 minutes ago' '+%H:%M')/,\$p" /home/jboss/log/server.log | grep "ERROR"
#How to find which logs files contain a String in the last n days (ex. 5 days)
$ find . -name "server.log*" -mtime -5 | xargs grep -i "OutOfMemoryError"
#How to count the number of Threads running
$ ps -eLf | grep [PID] | wc -l
#How to monitor a Java Process Heap size
jmap -heap PID
#How to compare two files side by side
sdiff -s standalone1.xml standalone2.xml