【发布时间】:2015-08-16 06:50:40
【问题描述】:
我正在为 Java Web 应用程序设置 ELK 堆栈。我用logstash成功解析了多行java堆栈跟踪,并在kibana中显示异常计数。现在我想显示一个日期直方图,其中包含按异常类分组的异常计数,即每分钟或每秒 2 个 java.lang.NullPointerException、3 个 java.lang.ArithmeticException。
在 kibana 中,我可以看到索引的完整堆栈跟踪。但是我无法按类可视化我的异常。这里的最佳做法是什么?尝试使用 Logstash 检索完全限定的类名并在 kibana 中进行术语过滤?或者有没有办法在kibana中使用ES的力量?
message 字段开头的示例:
2015-08-15 23:23:51.695 [qtp1010279661-1074] ERROR c.m.w.s.proxies.ProxyServlet:71 - Can't get content from url http://localhost:8080/...
org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect...
我的logstash配置:
input {
file {
path => "/Users/dbaq/web-app.log"
start_position => beginning
}
}
filter {
multiline {
pattern => "%{TIMESTAMP_ISO8601:timestamp}"
negate => true
what => "previous"
}
grok {
match => ["message", "(?m)%{TIMESTAMP_ISO8601:timestamp} \[%{DATA:thread}\]\s*%{LOGLEVEL:severity}\s*%{DATA:class}:%{NUMBER:line:int}\s*\- %{GREEDYDATA:message}"]
overwrite => [ "message" ]
}
date {
match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss.SSS" ]
}
}
output {
elasticsearch {
protocol => "http"
}
stdout {}
}
感谢您的帮助
编辑 1:
我的logstash 模式中的class 字段表示引发异常的类,在我的示例中为:c.m.w.s.proxies.ProxyServlet。我想按我的异常类聚合:org.apache.http.conn.HttpHostConnectException。
【问题讨论】:
标签: java logstash kibana-4 elastic-stack