# How can I set current time in field

**URL:** https://discuss.elastic.co/t/how-can-i-set-current-time-in-field/157542
**Category:** Logstash
**Created:** [November 20, 2018, 12:22pm UTC](https://discuss.elastic.co/t/how-can-i-set-current-time-in-field/157542 "2018-11-20T12:22:25Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![2501492a6edd02b1386b](https://avatars.discourse-cdn.com/v4/letter/2/9de0a6/32.png) [@2501492a6edd02b1386b](https://discuss.elastic.co/u/2501492a6edd02b1386b)
#### Post date: [November 21, 2018, 10:11am UTC](https://discuss.elastic.co/t/how-can-i-set-current-time-in-field/157542/3 "2018-11-21T10:11:07Z")

</div>

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', Time.now());"
        }

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

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

---

_[View the full topic](https://discuss.elastic.co/t/how-can-i-set-current-time-in-field/157542)._
