# Add field timestamp with current time

**URL:** <https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862>\
**Category:** Logstash\
**Created:** [September 6, 2016, 9:28am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862 "2016-09-06T09:28:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurabh\_Jambhule](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Saurabh\_Jambhule](https://discuss.elastic.co/u/Saurabh_Jambhule)\
**Post date:** [September 6, 2016, 9:28am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/1 "2016-09-06T09:28:34Z")

</div>

I want to update timestamp to current time and date.  
So how do I add field timestamp with current date and time.  
And how to remove old timestamp.

Thank you.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 6, 2016, 9:39am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/2 "2016-09-06T09:39:57Z")

</div>

Unless a message has a `@timestamp` field when it enters Logstash it'll create that field and initialize it with the current time. Depending on your configuration you might be able to just save that timestamp (possibly in another field).

Otherwise I think you need to use a ruby filter to create a field with the current time.

---

<div class="post-metadata">

**Author:** ![Saurabh\_Jambhule](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@Saurabh\_Jambhule](https://discuss.elastic.co/u/Saurabh_Jambhule)\
**Post date:** [September 6, 2016, 9:56am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/3 "2016-09-06T09:56:27Z")

</div>

Thank. It's working. But there is one problem, how do I change timezone?  
Currently it is only Z.  
But I want +5.30 .

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 6, 2016, 10:32am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/4 "2016-09-06T10:32:23Z")

</div>

Use [https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-timezone](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-timezone)

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 6, 2016, 10:51am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/5 "2016-09-06T10:51:05Z")

</div>

> Thank. It's working. But there is one problem, how do I change timezone?

The `@timestamp` field is by definition UTC.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:39am UTC](https://discuss.elastic.co/t/add-field-timestamp-with-current-time/59862/6 "2017-07-06T04:39:42Z")

</div>


