Howto convert this to a number?

Hi
I have a field in Logstash that I can't convert. The field value is DKK82,334.25 and is a string that I need to convert into a number.
I start by removing the DKK, and then I have tried to convert it into float and float_eu, but when I do that the value turns into 0.0.
I use gsub to remove the " DKK" and replace with a "" and after that I use convert but the value is just the 0.0
Any help will be appreciated.

The order different settings are executed in within a single mutate filter is not necessarily the order they are defined, so it is good practice to do this in distinct steps:

input {
  generator {
    lines => ['DKK82,334.25']
    count => 1
  } 
} 

filter {
  mutate {
    gsub => ["message", "DKK", ""]
  }
  mutate {
    convert => {
      "message" => "float"
    }
  }
}

output {
  stdout { codec => rubydebug }
}
1 Like

Thanks. It got me in the right direction and it works now.

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