Hi dears,
I want to grok nginx access log but i cant get the seperated field of the message ,
i tried to use overwrite and doesn't make the solution.
my Log format is below :
</>
Jun 10, 2021 @ 11:07:43.648
host:logstash.cluster
@timestamp:Jun 10, 2021 @ 11:07:43.648
tags:
_grokparsefailure
message:
52.61.52.88:64539 - - [02/Jun/2021:03:27:35 +0200] "GET https://test.al-domain/public/blank.html HTTP/1.1" 200 1745 "https://test.al-domain/modern/email/Inbox/conversation/2988" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" "65.35.42.14:8443" "65.35.42.14:443"
@version:1
path:/var/local/znginx_log.log
_id:jT1k9XkB9s8XMY09VrUf
_type:
_doc
_index:znginx_1
_score:
</>
filter {
grok {
match => { "message" => ["%{IPV4:ip_remote}:%{INT:port} - (?:%{DATA:Domain}\x5C%{USERNAME:user_name}|%{USERNAME:username}@%{DATA:Domain}|-) [%{TIMESTAMP_ISO8601:date_log} %{BASE10NUM:plustime}] %{DATA:req_method} %{DATA:request} HTTP/%{BASE10NUM:httpversion} %{BASE10NUM:response} (?:%{BASE10NUM:bytes}|-) (?:(?:%{URI:referrer}|-)|%{QS:referrer})(?:;|) %{DATA:agent_access} %{NOTSPACE:host} %{NOTSPACE:xff_clientip}" ] }
overwrite => ["message"]
}
date {
match => ["timestamp", "yy-MM-dd HH:mm:ss"]
target => "@timestamp"
timezone => "Europe/Moscow"
}
mutate {
remove_field => [ "timestamp" ]
}
}
</>