logstash-plugins / logstash-output-riemann

Apache License 2.0
5 stars 13 forks source link

Taking ttl from mapped fields fails with a type error #23

Closed ninaspitfire closed 4 years ago

ninaspitfire commented 4 years ago

Using map_fields => true to set the ttl of a Riemann event is not possible. The value is (at some point) cast to a string, and never cast back to the float type that Riemann expects, resulting in this error:

[ERROR] 2020-01-05 14:02:49.882 [[main]>worker3] riemann - Unhandled exception {:error=>#<TypeError: wrong argument type String (expected Float)>}

Repro

Run Riemann with this configuration:

(tcp-server  {:host "0.0.0.0"})

Create the following Logstash configuration:

input {
  stdin {}
}

filter {
  mutate {
    add_field => {
      "ttl" => 60
    }  
  }
}

output {
  riemann {
    map_fields => true
  }
}

Inject an event like:

echo '{}' | sudo logstash -f repro.conf