Logstash auto-transforming data, rendering it useless

Hey there,

I am using logstash to write data from my mssql database to elasticsearch.
For whatever reason logstash transfrom the db-field "Duration" which contains values in the style of: "00:00:45.4388525" into this: "2020-03-13T00:00:02.609Z".

I have tried all kinds of input-plugins, filter-plugins, changed the sql statement, transformed the db-field so it would not contain the ":", created a custom index-template.

The closest I got was using this filter:

filter {
mutate {
convert => { "duration" => "float" }

and changing the statement so the field would not contain ":".
In addition I mapped the field as "long" in the index-template.

This is the only way that even returned a number that could be formatted as a duration in kibana.
All the other methods I tried returned either strings or dates.

Does anyone actually know why logstash is auto transforming this number? I just want to be able to use the field-value as a duration in ms.

regards & thanks in advance.

If a column in a database is a date/time then the jdbc input will automatically transform it into a LogStash::Timestamp. You can probably prevent that by including a CAST in your SQL.

Indeed that seems to be the problem. Thanks a lot.

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