Time difference between two fields in a csv using ruby plugin

As the message says, you should be using event.get to access fields, and event.set to add them. For example, this code calculates the differences (in seconds) between two times. It does something slightly different to what you want, and comes from an aggregate filter, so is structured differently, but accesses and sets fields, so should give you some idea of what to do.

  code => "
    require 'time';
    starttime = Time.iso8601(map['starttime'].to_s).to_f;
    endtime   = Time.iso8601(event.get('@timestamp').to_s).to_f;
    event.set('overall_timetaken', endtime - starttime);
  "