which version of logstash are you using? this, including your full configuration will be required to know more about your problem, I just did a quick check and
skywalker% ./logstash-2.3.0/bin/logstash -f ruby.conf
Settings: Default pipeline workers: 4
Pipeline main started
{
"cpu_user_p" => 45.0,
"message" => "Hello world!",
"@timestamp" => 2016-06-08T14:24:29.149Z,
"host" => "skywalker",
"sequence" => 0,
"@version" => "1"
}
Pipeline main has been shutdown
stopping pipeline {:id=>"main"}
skywalker%
is your issue because in your first code you use cpu_user_p while in the second you use 'cpu.user_p see the dot after cpu vs the underscore in the first part.
Top beat event['cpu.user_p'] (with a dot gives a percentage as a decimal it uses 0.01 to represent 1%
I want to multiply it by 100 so that it is a true percentage. If I can retain the field name of cpu.user_p then so much the better. Thought it safer to change the . to an _ while I test it so that I can see both versions. So the intention was that the new true percentage would be called cpu_user_p
Seems to work OK as your program below. However when using it with input from topbeat cpu_user_p is always 0, and I cant understand why. I thought that using to_f would cast it to a float in logstash if it was not already if that type ?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.