Hi All,
i am facing the grokparsefailure for my logs even the grok debugger is showing all parsed data but logstash is failing for all fields. below is my filter of logstash
filter {
grok {
match => { "message" => "%{IPORHOST:[source][address]} (?:-|%{HTTPDUSER:[access][user][identity]}) (?:-|%{HTTPDUSER:[user][name]}) \[%{HTTPDATE:timestamp}\] (%{HTTPDUSER:[user][name]})? \"(?:%{WORD:[http][request][method]} %{NOTSPACE:[url][original]}(?: HTTP/%{NUMBER:[http][version]})?|%{DATA})\" (?:-|%{INT:[http][response][status_code]:int}) (?:-|%{INT:[http][response][body][bytes]:int}bytes) \"(?:-|%{IPORHOST:[destination][address]})\" \"%{DATA:session}\" \[%{DATA:extra}\] (%{INT:time_taken:int})ms" }
remove_field => ["message"]
}
}
output
{
stdout { codec => rubydebug }
and this is the output from debug modes.
"event" => {
"original" => "{\"@timestamp\":\"2023-08-03T08:29:04.402Z\",\"@metadata\":{\"beat\":\"filebeat\",\"type\":\"_doc\",\"version\":\"8.5.3\"},\"agent\":{\"ephemeral_id\":\"a6a96b92-5584-44ed-b629-dd19469.uat.dbs.com\",\"type\":\"filebeat\",\"version\":\"8.5.3\"},\"log\":{\"offset\":0,\"file\":{\"path\":\"/tmp/csec/httpd/access_log1.log\"}},\"message\":\"10.92.245.37 - - [12/Jul/2023:08:00:07 +0800] - \\\"GE] 0ms\",\"metadata\":{\"component_type\":\"csec_httpd_app\",\"timezone\":\"Asia/Singapore\",\"application\":\"CSEC-ENT-HD-ACC\"},\"topic\":\"testtopic2006\",\"input\":{\"type\":\"filestream\"},\"ecs\":{\"ver
},
"message" => "{\"@timestamp\":\"2023-08-03T08:29:04.402Z\",\"@metadata\":{\"beat\":\"filebeat\",\"type\":\"_doc\",\"version\":\"8.5.3\"},\"agent\":{\"ephemeral_id\":\"a6a96b92-5584-44ed-b629-dd1946928at.dbs.com\",\"type\":\"filebeat\",\"version\":\"8.5.3\"},\"log\":{\"offset\":0,\"file\":{\"path\":\"/tmp/csec/httpd/access_log1.log\"}},\"message\":\"10.92.245.37 - - [12/Jul/2023:08:00:07 +0800] - \\\"GET 0ms\",\"metadata\":{\"component_type\":\"csec_httpd_app\",\"timezone\":\"Asia/Singapore\",\"application\":\"CSEC-ENT-HD-ACC\"},\"topic\":\"testtopic2006\",\"input\":{\"type\":\"filestream\"},\"ecs\":{\"versi
"@version" => "1",
"@timestamp" => 2023-08-03T08:29:15.239531418Z,
"tags" => [
[0] "_grokparsefailure"
]
}
below is one of my sample logs data which worked well in grok debugger. since i have custom logs so grok pattern is designed like it . might be improve better but logstash currently is failing.
10.92.11.10 - - [12/Jul/2023:08:00:07 +0800] - "GET /isalive HTTP/1.1" 200 15bytes "-" "ZK3tBx_wNPwl3QRmANzTWgAAAA8" [-] 0ms```