Time difference between two fields in a csv using ruby plugin

Hi Badger , The below seemed to work for me

ruby {
    init => "require 'time'"
    code => "
           starttime = Time.iso8601(event.get('CREATED').to_s).to_f;
           endtime   = Time.iso8601(event.get('RESOLVED').to_s).to_f;
           event.set('time_diff', endtime - starttime);
            "
    add_tag => [ "calculated_time_difference" ]
  }

Thank you for your input :slight_smile: