Logstash 6.8.10
Filebeat 6.8.9
Filebeat config:
filebeat.inputs:
- type: log
enabled: true
paths:
- '/path/to/file'
tags:
- 'app'
fields:
app_id: some_app
multiline.pattern: '^\[[0-9]{4}\-[0-9]{2}-[0-9]{2}'
multiline.negate: true
multiline.match: after
logging.level: info
logging.metrics.period: 10m
logging.to_files: true
logging.files:
keepfiles: 4
permissions: 0644
Filebeat is sending Logstash data with message fields like this:
"message": "[2020-10-28 15:27:24,646] ERROR - SomethingSomething.otherThing(SomethingSomething.java:85) - Exception while doing something\njava.lang.NullPointerException\notherMethodCalls"
Now, in my Logstash setup I'd like to parse everything up to the first new line character, basically just the first log line.
What I thought about using was this:
filter {
grok {
match => { "message" => "^\[%{TIMESTAMP_ISO8601:[@metadata][logtime]}\]%{SPACE}%{LOGLEVEL:level}%{SPACE}-%{SPACE}%{DATA:classInfo}%{SPACE}-%{SPACE}%{GREEDYDATA:[@metadata][messageBody]}$" }
}
}
But this for some reason does not work:
{
"classInfo": "SomethingSomething.otherThing(SomethingSomething.java:85)",
"level": "ERROR",
"[@metadata][logtime]": "2020-10-28 15:27:24,646",
"[@metadata][messageBody]": "Exception while doing something\njava.lang.NullPointerException\notherMethodCalls"
}
Afaik GREEDYDATA should not match new line unless the (?m)
flag is given. So what am I getting wrong here? Thanks!