grep

Ctrl+v, Ctrl+i to enter a tab

To grep lines from log4j error log with date and subsequent caused by:
egrep "2009.*xception|Caused by|2009.*ERROR" xxx_errorlog > ~/xxx_errorlog.exceptions

To gzip logs once daily:
while true
do ls | egrep "LockMonitor.*.log.20..-..-.." | egrep -v gz | xargs gzip
sleep 86400
done

To grep threads from JVM
kill -3 <jbossPid> - dumps to jboss log
OR
jstack > <filename>

grep "tid=" thread.dump > allThreads
grep -B 1 BLOCKED thread.dump > blocked
grep -B 1 RUNNABLE thread.dump > runnable
grep -B 1 WAITING thread.dump > waiting
egrep "tid|locked" thread.dump > locks

-B 1 returns previous line
-n will prepend line numbers
Do multiple greps appending with >>, then sort

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout