# How to add another timestamp?

**URL:** <https://discuss.elastic.co/t/how-to-add-another-timestamp/115808>\
**Category:** Logstash\
**Created:** [January 17, 2018, 1:42am UTC](https://discuss.elastic.co/t/how-to-add-another-timestamp/115808 "2018-01-17T01:42:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [January 17, 2018, 1:42am UTC](https://discuss.elastic.co/t/how-to-add-another-timestamp/115808/1 "2018-01-17T01:42:43Z")

</div>

Hi,

I'm ingesting some logs containing a @timestamp using the json codec. This is working but I'd also like to save the timestamp containing the date and time logstash ingested my logs.

Can logstash create a new timestamp (not @timestamp but in a new field)? I want to use the @timestamp from my logs to analyze data so I don't want to touch that but for my use case the log time and ingestion time might be very different and it would be helpful in some cases to know when data was ingested.

---

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [January 17, 2018, 3:01am UTC](https://discuss.elastic.co/t/how-to-add-another-timestamp/115808/2 "2018-01-17T03:01:12Z")

</div>

Seems this is working.

```auto
  ruby {
     code => 'event.set("@ingest_time", Time.now.strftime("%Y-%m-%d %H:%M:%S"))'
  }
```

---

<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:** [February 14, 2018, 3:01am UTC](https://discuss.elastic.co/t/how-to-add-another-timestamp/115808/3 "2018-02-14T03:01:31Z")

</div>

Closed on February 14, 2018, 3:01am UTC

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