我正在尝试使用logstash解析iis日志文件并将它们发送到elasticsearch。
我有以下日志行
2014-02-25 07:49:32 172.17.0.96 GET /config/integration - 80 - 172.17.28.37 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/33.0.1750.117+Safari/537.36 401 2 5 15
并使用此过滤器:
filter {
if [message] =~ "^#" {
drop {}
}
grok {
match => ["message", "%{TIMESTAMP_ISO8601} %{IP:host_ip} %{URIPROTO:method} %{URIPATH:path} (?:-|%{NOTSPACE:uri_query}sern) %{NUMBER:port} %{NOTSPACE:username} %{IP:client_ip} %{NOTSPACE:useragent} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:scstatus} %{NUMBER:timetaken}"]
}
date {
match => ["logtime", "YYYY-MM-dd HH:mm:ss"]
}
}
一切都被正确解析,但结果@timstamp 字段是我运行解析的时间,而不是日志事件的时间。这会导致所有日志事件在我查看它们时启动 logstash 时最终堆叠在一起。我希望 @timestamp 成为实际事件的时间。
我究竟做错了什么?