For some reason when I try to replace the @timestamp field in my apache access log events, it doesn't work. For Nginx it did work with the same date format.
This is my log date format : [10/Dec/2014:13:01:06 -0500]
This is my logstash.conf -
if [type] == "apache" {
grok {
match => { "message" => "%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:time}\] \"(?:%{WORD:method} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:bytes}|-)" }
add_tag => [ "apache", "grokked" ]
}
date {
match => [ "[time]" , "dd/MMM/YYYY:HH:mm:ss Z" ]
locale => "en"
add_tag => ["date_filtered"]
}
}
The @timestamp field stays in this format - 2014-12-10T18:01:06.000Z
update: This is the full configuration -
There are no errors in the logs, only logstash startup log lines.
My logstash configuration file is as follows :
input {
redis {
host => "<redis_server>"
port => "<redis_port>"
data_type => 'list'
key => 'logstash'
type => 'redis'
threads => 300
}
filter {
multiline {
pattern => "(^\s)|(^INFO.+)|(^SEVERE.+)"
what => "previous"
add_tag => ["multiline"]
stream_identity => '%{host}.%{file}.%{type}'
}
if [type] == "apache" {
grok {
match => { "message" => "%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:time}\] \"(?:%{WORD:method} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:bytes}|-)" }
add_tag => [ "apache", "grokked" ]
}
date {
match => [ "[time]" , "dd/MMM/YYYY:HH:mm:ss Z" ]
locale => "en"
add_tag => ["date_filtered"]
}
}
}
output {
elasticsearch {
host => "<ES_server>"
port => "9300"
cluster => "elasticsearch"
embedded => false
node_name => "logstash"
}
}
And the result is :

When it should actually be :

Thanks.
timein your grok filter ? how are you extracting time out of yourmessage? - MUFC\[%{HTTPDATE:time}\]is included in the pattern. - Magnus Bäck