How can I set current time in field

(Егор Крид) #1

Could you please share with me info how I can to set current system time in field "@timestamp".
In my case, I successfully copy field with @timestamp in filed "real_timestamp".
And then I would like to set @timestamp with system time of the server we logstash running.

(Lewis Barclay) #2

You could try the following:

    ruby { 
         code => "event.set('systemtime',;"

(Егор Крид) #3

Hi guys,
Thanx @Eniqmatic
I've done this job with the following config:

 mutate {
    add_field => { "realtimestamp" => "%{@timestamp}" }

      ruby {
        code => "event.set('logstash_processed_at',;"

    mutate {
    convert => { "logstash_processed_at" => "string" }

    date {
    match => [ "logstash_processed_at", "ISO8601" ]
    target => "@timestamp"
    add_tag => "timestamp_changed"

(Lewis Barclay) #4

Correct well done!

Please mark as solved! :slight_smile:

(system) closed #5

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