Timestamps precision in beats

What I ended up with now is:

  if [@metadata][beat] == "filebeat" {
    ruby {
      code => "event.set('logstash_processed_at', Time.now());"
    }
  }

Found it here: Add current timestamp to a logstash_processed_at field