I need to parse the following line:
2016-12-02 11:54:03,107 Tests run: 2344, Failures: 0, Errors: 1, Skipped: 14, Time elapsed: 1,480.535 sec <<< FAILURE! - in com.werum.pasx.servicetests.ebrequipment.TestSuiteEbrEquipmentBf
Here my grok pattern:
grok {
break_on_match => true
match => [ "message", "(?m)%{TIMESTAMP_ISO8601}\s*%{TIMESTAMP_ISO8601:logdate}\s.*INFO\s.*?Time elapsed:\s(?<duration>[0-9.,+-]+)\s*sec\s.*com\.werum\.pasx\.%{DATA:probe}(\s|\n)%{GREEDYDATA:msg}"]
match => [ "message", "(?m)%{TIMESTAMP_ISO8601}\s*%{TIMESTAMP_ISO8601:logdate}\s.*INFO\s.*?Time elapsed:\s(?<duration>[0-9.,+-]+)\s*sec\s.*com\.werum\.pasx\.%{GREEDYDATA:probe}"]
match => [ "message", "(?m)%{TIMESTAMP_ISO8601}\s*%{TIMESTAMP_ISO8601:logdate}\s%{GREEDYDATA:msg}"]
match => [ "message", "(?m)%{TIMESTAMP_ISO8601:logdate}\s%{GREEDYDATA:msg}"]
}
mutate {
convert => [ "duration", "float" ]
}
It works, if the numbers follwing "Time collapsed:" don't contain a comma as delimiter. In my example duration contains 1 after mutating.
Any idea, how I can get the correct number ?