Hi Philipp,
I send logs from filebeat to logstash. Logstash has a date filter which can parse the timestamp. I can share my configuration if you have problems with logstash.
Thanks for responding.
I put the below logstash 5.3 configs in place over the weekend and it seems to be working well. It
would be great if you can share your config as well.
filter {
if [type] == "sensu" {
ruby {
init => 'require "date"'
code => '
t = event.get("timestamp");
event.set("ts_iso8601", DateTime.parse(t).iso8601(3) );
'
}
date {
match => ["ts_iso8601" , "ISO8601" ]
target => "@timestamp"
add_tag => [ "ts_iso8601_applied" ]
remove_field => [ "ts_iso8601", "timestamp" ]
}
mutate {
remove_field => [ "event.client.redact" ]
}
}
}
And this is how the event now looks like.
{
"offset" => 8267507,
"level" => "info",
"subscribers" => [
[0] "admins",
[1] "os:Ubuntu"
],
"input_type" => "log",
"source" => "/var/log/sensu/sensu-server.log",
"message" => "publishing check request",
"type" => "sensu",
"tags" => [
[0] "beats",
[1] "beats_input_codec_plain_applied",
[2] "ts_iso8601_applied"
],
"@timestamp" => 2017-04-10T05:25:29.397Z,
"payload" => {
"occurrences" => 5,
"high_flap_threshold" => 60,
"standalone" => false,
"refresh" => 3600,
"handle" => true,
"ttl" => 300,
"timeout" => 15,
"command" => "/usr/lib/nagios/plugins/check_procs -w 3 -c 5 -s Z",
"aggregate" => false,
"handlers" => [
[0] "mailer",
[1] "logstash"
],
"name" => "zombie_procs",
"issued" => 1491801929,
"low_flap_threshold" => 20
},
"@version" => "1",
"beat" => {
"hostname" => "sensu-nmv-mon1",
"name" => "sensu-nmv-mon1",
"version" => "5.3.0"
},
"host" => "sensu-nmv-mon1"
}
Thanks again.
@shankerbalan
···
On 09-Apr-2017, at 1:27 PM, Philipp H <hellmi@gmail.com> wrote: