Ruby filter: Ruby exception occurred

Hello all

I am trying to use a ruby filter to insert the current time if the 'End ' field from the csv is blank

here is part of my filter :

  filter {
    if [projectid] == "sampledata" {
      csv {
      columns =>["Number","Category","Subcategory","Priority","Incident_state","Created","Resolved","Closed","Value","Resolving_Group","Start","End"]    
      }


ruby {
    code => "
	   if event.get('End') =~ /^\s*$/
	   event.set('End',event.get('@timestamp'))            
           end
	   "
    add_tag => [ "calculated_End_time" ]
  }

The error code i am receiveing is :

[ERROR] 2018-04-18 14:27:10.835 [Ruby-0-Thread-10@[main]>worker1: /usr/share /logstash/logstash-core/lib/logstash/pipeline.rb:392] ruby - Ruby exception occurred: invalid date: ""

Any help will be appreciated and thank you in advance

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