Hello,
Thank you, i changed the code:
mutate {
add_field => { "time1" => "%{day1}/%{month1}/%{year1}:%{hour1}:%{minute1}:%{second1} +0200" }
}
date {
match => [ "time1", "yyyy-MM-dd HH:mm:ss.SSS Z" ]
}
mutate {
remove_field => [ "year1", "month1", "day1", "hour1", "minute1", "second1" ]
}
grok {
break_on_match => false
match => [ "timerest", "%{SPACE}%{YEAR:year2}/%{MONTHNUM:month2}/%{MONTHDAY:day2}%{SPACE}%{HOUR:hour2}:%{MINUTE:minute2}:%{SECOND:second2}%{GREEDYDATA:timerest2}" ]
}
mutate {
add_field => { "time2" => "%{day2}/%{month2}/%{year2}:%{hour2}:%{minute2}:%{second2} +0200" }
}
date {
match => [ "time2", "yyyy-MM-dd HH:mm:ss.SSS Z" ]
}
mutate {
remove_field => [ "year2", "month2", "day2", "hour2", "minute2", "second2", "timerest2" ]
}
date {
match => ["[time1]", "ISO8601"]
target => "[time1]"
}
date {
match => ["[time2]", "ISO8601"]
target => "[time2]"
}
ruby {
init => "require 'time'"
code => "duration = (event.get('time2') - event.get('time1')) rescue nil; event.set('Log_duration', duration); "
}
}
}
Now i get the following error:
{:timestamp=>"2017-10-31T13:39:12.047000+0100", :message=>"Failed parsing date from field", :field=>"time1", :value=>"31/10/2017:13:38:42.259 +0200", :exception=>"Invalid format: "31/10/2017:13:38:42.259 +0200" is malformed at "/10/2017:13:38:42.259 +0200"", :config_parsers=>"yyyy-MM-dd HH:mm:ss.SSS Z", :config_locale=>"default=en_US", :level=>:warn}
{:timestamp=>"2017-10-31T13:39:12.053000+0100", :message=>"Failed parsing date from field", :field=>"time2", :value=>"31/10/2017:13:38:58.313 +0200", :exception=>"Invalid format: "31/10/2017:13:38:58.313 +0200" is malformed at "/10/2017:13:38:58.313 +0200"", :config_parsers=>"yyyy-MM-dd HH:mm:ss.SSS Z", :config_locale=>"default=en_US", :level=>:warn}
{:timestamp=>"2017-10-31T13:39:12.055000+0100", :message=>"Failed parsing date from field", :field=>"[time1]", :value=>"31/10/2017:13:38:42.259 +0200", :exception=>"Invalid format: "31/10/2017:13:38:42.259 +0200" is malformed at "/10/2017:13:38:42.259 +0200"", :config_parsers=>"ISO8601", :config_locale=>"default=en_US", :level=>:warn}
{:timestamp=>"2017-10-31T13:39:12.056000+0100", :message=>"Failed parsing date from field", :field=>"[time2]", :value=>"31/10/2017:13:38:58.313 +0200", :exception=>"Invalid format: "31/10/2017:13:38:58.313 +0200" is malformed at "/10/2017:13:38:58.313 +0200"", :config_parsers=>"ISO8601", :config_locale=>"default=en_US", :level=>:warn}
Any ideas?
Thank you,