Hi Everyone,
I'm trying to parse a tab separated access log and having some trouble with updating the @timestamp field in order to store the actual event time, using logstash 2.2.
Here is a log sample:
2016-03-14 23:05:04 10.0.0.1:8001 GET /transact/images/HealthCheck.gif 10.10.10.1 - 200 0.0010 43 10.10.10.2 -
Here is my filter:
filter {
if [type] == "wl-access" {
grok {
match => { "message" => "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day}\t%{TIME:time}\t%{IP:server_ip}:%{NUMBER:server_port}\t%{WORD:method}\t%{URIPATH:uri}\t%{IP:client_ip}\t(?:%{NOTSPACE:uri_query}|-)\t%{NUMBER:status}\t%{NUMBER:response_time}\t%{NUMBER:bytes}\t(?:%{NOTSPACE:user}|)\t(?:%{NOTSPACE:post_args}|)\t%{NOTSPACE:url}\t(?:%{GREEDYDATA:user_agent}|-)" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
mutate {
add_field => {
"timestamp" => "%{year}-%{month}-%{day} %{time}"
}
}
date {
match => [ "timestamp" , "%{TIMESTAMP_ISO8601}" ]
}
}
}
This results in the following error:
Error: Cannot register filter date plugin. The error reported is:
Illegal pattern component: T for pattern '%{TIMESTAMP_ISO8601}'
I am however able to successfully parse the value stored in the timestamp field with the grokdebugger, using the %{TIMESTAMP_ISO8601} pattern. Also, when I comment out the date / match part, logstash records the timestamp correctly:
"timestamp" => "2016-03-14 23:05:04"
I've been at this for several hours, so any feedback would be greatly appreciated :).
Another odd thing is when attempting to add a custom pattern for the long match string, it fails with a grok parsing error. This too parses fine in the grok debugger.. I narrowed it down to the hyphens in '%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day}', but gave up once I figured out that it works when using it in the config directly. This is less of a problem now, but would be interested to see if anyone experienced this issue.
Thanks so much!