【发布时间】:2018-09-04 11:13:33
【问题描述】:
我想在 ELK stack 6.3.2 版本中解析一个标准的 JAVA 异常,它看起来像:
2018-09-04 05:29:03.955 [default task-38] ERROR c.r.e.u.util.MongoConnectionUtil.createMongoUser - Exception occured while creating mongo userCommand failed with error 11000: 'User "asdf" already exists' on server 192.168.1.33:27017. The full response is { "ok" : 0.0, "errmsg" : "User \"asdf\" already exists", "code" : 11000, "codeName" : "DuplicateKey" }
com.mongodb.MongoCommandException: Command failed with error 11000: 'User "qwer" already exists' on server 192.168.1.33:27017. The full response is { "ok" : 0.0, "errmsg" : "User \"asdf\" already exists", "code" : 11000, "codeName" : "DuplicateKey" }
at com.mongodb.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:115)
at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:114) ...
我的 filebeat.yml 有配置:
filebeat.inputs:
- type: log
enabled: true
paths:
- C:\logs\test.log
multiline.pattern: '^[[:space:]]+(at|\.{3})\b|^Caused by:'
multiline.negate: false
multiline.match: after
我的 logstash.conf 输入看起来像:
input {
beats {
port=>5044
codec => multiline {
pattern => "^\s"
what => "previous"
}
}
但是 logstash 说无法解析模式,实际上它崩溃了异常。如果我只删除codec 配置,则异常的第一行将被解析。我也在https://discuss.elastic.co/t/multiline-parsing-patterns/147171 提出了同样的问题,但没有回应。
【问题讨论】:
标签: elasticsearch logstash elastic-stack filebeat