I am trying to run a script and take the output of the script in the command line as an input to elasticsearch. I am then trying to convert this input into a float, and log that through logstash.
My code currently looks like:
input {
exec {
command => "./cpu_usage.sh"
type => "float"
interval => 3
}
}
filter {
mutate {
add_field => {"cpu_usage" => "%{message}" }
}
mutate {
convert => {"%{cpu_usage}" => "float" }
}
}
output {
elasticsearch{
}
file {
path => "/Users/changeme/dev/mylogstash/pipeline_out.log"
}
stdout{}
}
However, when viewing in Kibana, the type of cpu_usage is a string. I have tried deleting and reindexing the database already, and cpu_usage is still a string. Why is this so?