After upgrading to logstash6 ruby code stop working

Hi all.
i would like to get your help converting my below code to the new ruby code.
after i upgraded to logstash6 ( from logstash2) this math function stop working
i need to calculate the profit .
i know it has changed to event.set and event.get , but its not working for me.
thanks .

ruby {

code => "event['Profit'] = (event['K2_TotalBetPlaced'].to_f - event['K2_WinAmount'].to_f).round(2)"

}

event.set('Profit', (event.get('K2_TotalBetPlaced').to_f - event.get('K2_WinAmount').to_f).round(2))
1 Like

many thanks!
works

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