Hi, I want the logs of my service to be processed using the filter grok. But instead I get _grokparsefailure.
Could you tell me what the problem is?
My logstash configuration:
input {
file {
path => ["/path/to/log/*.log"]
exclude => [ "*.gz", "*.zip", "*.rar","*.xlog"]
start_position => "end"
discover_interval => 1
}
}
filter {
grok{
match => {"message" => "%{INT:count}[T ]%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day}[T ]%{HOUR:hour}:?%{MINUTE:min}(?::?%{SECOND:sec})?[T ]\(?%{BASE10NUM}\:?%{BASE16NUM}\)[T ]\[?%{LOGLEVEL:exception_level}\s*][T ]\:[T ]\<?%{USERNAME:user}\>[T ](%{GREEDYDATA:message})?"}
}
}
output {
elasticsearch {
hosts => "http://IP_ADDR:9200"
index => "logs-%{+YYYY.MM.dd}"
}
}
My logs example:
1 2018-05-04 12:02:47.852003 (3476:0x00007f466d7fb700) [WARNING] : <Root> Failed to close session to service
My index:
{
"_index": "logs-2018.06.28",
"_type": "logs",
"_id": "AWRGVgCw5z-x38VXIohu",
"_score": 1,
"_source": {
"path": "/path/to/log/***.log",
"@timestamp": "2018-06-28T12:19:58.752Z",
"@version": "1",
"host": "RHEL6.local",
"message": "1 2018-05-04 12:02:47.852003 (3476:0x00007f466d7fb700) [WARNING] : Failed to close session to service ",
"tags": [
"_grokparsefailure"
]
}
}