我想從tomcat日誌中提取錯誤|異常。由於tomcat日誌有多行錯誤細節。我想將每個新日誌條目都視爲我的記錄,即日期可能充當記錄分隔符。使用awk/perl過濾tomcat日誌
Oct 4, 2012 4:00:38 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.google.common.base.Stopwatch. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at com.myweb.ontest.stats.RpcInterceptor.intercept(RpcInterceptor.java:45)
at com.myweb.ontest.platform.SupplySource$Iface$$EnhancerByCGLIB$$6b5e8142.finalize()
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
Oct 4, 2012 4:00:38 PM Org.apache.catalina.loader ....
請讓我知道它如何用awk/perl腳本來完成。
awk '/^[A-Z][a-z]/ && f++{print ""}1' file
,所以你可以通過使用一個空行作爲記錄分隔輕鬆地處理它在隨後的awk腳本:
感謝
謝謝。 +1爲我提供了一個從日誌中提取錯誤|異常的密鑰。 –
+1?如何abt + 25 :) – Himanshu