Help with Date


(debarun ghosh) #1

Hi,

I need to replace the time coming from the logs to timestamp field.

But i keep getting a parse failure.

The loglines look like

Time Stamp 11/14/16 15:14:25 Event Number 2004

I am using the following filters:-

grok {
patterns_dir => [ "/etc/logstash/conf.d/pattern" ]
match => [ "message","Time Stamp %{DATE:logdate} %{TIME:logtime} Event Number %{NUMBER:enevtnumber} ]
}

mutate {
add_field => {
"timestamp" => "%{logdate} %{logtime}"
}}

date {
locale => "en"
match => [ "timestamp" , "dd/mm/yy HH24:mi:ss" ]
}


(debarun ghosh) #2

Hi,

Any help is welcome.

Regards,
Debarun.


#3

i have this and it works:

 date
                    {
                            match => ["time3", "UNIX_MS"]
                                    target => "myTime"
                    }

so try to add the target line to create your timestamp variable.


(Hans) #4

Maybe this will work for you:
date { locale => "en" match => ["timestamp", "dd/MM/YY HH:mm:ss", "ISO8601"] timezone => "Africa/Windhoek" target => "@timestamp" add_field => { "debug" => "timestampMatched"} }


(Andrew) #5

In the example you posted you are missing the trailing quotation in your match pattern.

should be


(debarun ghosh) #6

Hi Guys,

Thanks for the response.

@Hans

This one worked , Thanks once again.

regards,
Debarun


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.