Date parse failure but format looks correct?

Hi,

I'm using a bit of ruby to generate a future timestamp. I want to set this as the @timestamp but for whatever reason the date is not accepted no matter the date format I pick (ISO8601, mm:ss,SSS etc.).

stdout
@current_time" => 2019-08-10T08:34:14.587Z

relevant part of the config

ruby {
   code => "event.set('@current_time', (Time.now)+2678400)"
}
date {
   match => [ "@current_time", "ISO8601" ]
   target => "@timestamp"
}

What am I doing wrong?

Hey,

I'm not really sure why date filter is not working as expected here.

As an alternative, try the below instead of date filter

mutate {
  copy => { "@current_time" => "@timestamp" }
}
1 Like

A date filter cannot parse a Logstash::TimeStamp. It can only parse a string. This is a known issue.

2 Likes

I did not know that, now I know :slight_smile:

Thanks.

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