0

我有一个日志文件作为..

>java.lang.IllegalStateException: Unable to crypt bytes with cipher [javax.crypto.Cipher@61e02bf7].
>Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
>org.apache.solr.client.solrj.SolrServerException: Error executing query
>org.apache.jasper.JasperException: javax.servlet.ServletException: >net.sourceforge.stripes.exception.StripesJspException: An exception was raised while invoking
>Caused by: javax.servlet.ServletException: net.sourceforge.stripes.exception.StripesJspException: An exception was raised while invoking a layout. The layout used w
>Caused by: org.apache.jasper.JasperException: java.util.ConcurrentModificationException
>java.lang.NumberFormatException: empty String
>com.hk.exception.DefaultWebException: Order Total cannot be lesser than 0
>java.lang.NumberFormatException: For input string: ".E0"

我只需要那些以“例外:”结尾的单词并且没有重复单词的时间......例如像......

IllegalStateException   1
IllegalBlockSizeException  1
SolrServerException  1
JasperException  2
ServletException  2
NumberFormatException  2
DefaultWebException  1

请帮忙 ....

4

3 回答 3

2

如果您发布的日志文件被放入名为 log 的文件中,请尝试以下操作:

egrep -o '\<\w+Exception\>' log | sort | uniq -c

这会给你:

  1 ConcurrentModificationException
  1 DefaultWebException
  1 IllegalBlockSizeException
  1 IllegalStateException
  2 JasperException
  2 NumberFormatException
  2 ServletException
  1 SolrServerException
  2 StripesJspException
于 2012-12-14T06:18:19.097 回答
0

或者你可以简单地使用

grep "<your search key word>" <log-file-name>如果需要,将输出重定向到文件。

grep 命令也有几个选项。

于 2012-12-14T06:22:15.003 回答
0
awk '{ for(i=1;i<=NF;++i) if (match($i,"Exception")!=0) {arr[gensub(/.*\.([a-zA-Z]*Exception[a-zA-Z]*).*/,"\\1","", $i)]++;} } END { for(v in arr) {print v, arr[v];} }' log

这是它的工作原理:

>awk '{ for(i=1;i<=NF;++i) if (match($i,"Exception")!=0) {arr[gensub(/.*\.([a-zA-Z]*Exception[a-zA-Z]*).*/,"\\1","", $i)]++;} } END { for(v in arr) {print v, arr[v];} }' log
ServletException 2
JasperException 2
ConcurrentModificationException 1
DefaultWebException 1
NumberFormatException 2
StripesJspException 2
IllegalStateException 1
SolrServerException 1
IllegalBlockSizeException 1
于 2012-12-14T07:21:58.270 回答