I'm having trouble with some date parsing. The entry I'm getting doesn't have a year in the datestamp, so I'm trying to pull the year out of @timestamp, and then put the proper timestamp back into @timestamp.
So my date format looks like:
Mar 22 15:09:49
What I have done is this:
filter {
dissect {
mapping => [ "@timestamp", "%{year}-%{?MON}-%{?DAY}T%{?HOUR}:%{?SEC}:%{?MIN}%{?REMAINDER}" ]
}
grok {
match => ["message", "%{MONTH:month} %{MONTHDAY:day} %{NOTSPACE:time} %{GREEYDATA:msg}" ]
}
mutate {
add_field => {
"gen_datetime" => "%{year}-%{month}-%{day} %{time}"
}
remove_field => [ "year", "month", "day", "time" ]
}
date {
match => [ "gen_datetime", "yyyy-MMM-dd HH:mm:ss" ]
target => "@timestamp"
}
}
The idea is to put the log values into gen_datetime, and then use that to move back into @timestamp.
The error I am getting is: "reason"=>"failed to parse [gen_datetime]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2017-Mar-22 15:09:49" is malformed at "-Mar-22 15:09:49""}
To me, it looks right. Any clue on what I'm doing wrong?