What I am trying to do is calculate the % of packets that didn't make it ( % of Packets Lost) but no matter the figures input in Packets Sent / Received, packetloss1 is always equals to 0 and I'm unsure why that is
I suspect [packets-received] and [packets-sent] are integers. Try
ruby {
code => '
received = event.get("[packets-received]")
sent = event.get("[packets-sent]")
if sent and received
event.set("[json][event][packetlosspercentage]", 100 * (1.0 - received.to_f / sent.to_f))
end
'
}
Only the output is still the same in the Logstash console -
[ERROR][logstash.filters.ruby ][main] Ruby exception occurred: undefined method `*' for nil:NilClass
I can see in the event that comes into Elastic that received is 6000 and sent is 7265 but im having trouble getting this filter to perform those calculations - and yes it is an integer
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.