# Backdating @timestamp into ES data

**URL:** <https://discuss.elastic.co/t/backdating-timestamp-into-es-data/86531>\
**Category:** Logstash\
**Created:** [May 20, 2017, 3:05pm UTC](https://discuss.elastic.co/t/backdating-timestamp-into-es-data/86531 "2017-05-20T15:05:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chuchurocket27](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@chuchurocket27](https://discuss.elastic.co/u/chuchurocket27)\
**Post date:** [May 20, 2017, 3:05pm UTC](https://discuss.elastic.co/t/backdating-timestamp-into-es-data/86531/1 "2017-05-20T15:05:14Z")

</div>

I have a SQL table that I plan on ingesting via Logstash into Elasticsearch. The entire table needs to be sucked in, but the date in which the data was _originally generated_ is important to me - that is, I want the `@timestamp` for each resulting document to match a `timestamp` field that's in my SQL database. How do I do that?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 20, 2017, 3:56pm UTC](https://discuss.elastic.co/t/backdating-timestamp-into-es-data/86531/2 "2017-05-20T15:56:16Z")

</div>

The code for the [logstash-input-jdbc](https://github.com/logstash-plugins/logstash-input-jdbc/blob/master/lib/logstash/plugin_mixins/jdbc.rb#L290-L303) plugin already converts SQL time and date values into Logstash Timestamp values. What you will need to do is take the value of your timestamp field, whatever it may be named, and overwrite the `@timestamp` field with that value.

That could be as simple as having the returning field name in your SQL query be `@timestamp`.

---

<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:** [June 17, 2017, 3:56pm UTC](https://discuss.elastic.co/t/backdating-timestamp-into-es-data/86531/3 "2017-06-17T15:56:24Z")

</div>

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