# Method to timestamp my logstash events

**URL:** https://discuss.elastic.co/t/method-to-timestamp-my-logstash-events/135888
**Category:** Logstash
**Created:** [June 14, 2018, 9:46am UTC](https://discuss.elastic.co/t/method-to-timestamp-my-logstash-events/135888 "2018-06-14T09:46:22Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [June 14, 2018, 2:20pm UTC](https://discuss.elastic.co/t/method-to-timestamp-my-logstash-events/135888/3 "2018-06-14T14:20:51Z")

</div>

Provided that you use a single pipeline worker thread (--pipeline.workers 1) you could save it in a ruby instance variable. Something like

```
if [ID2] == "000003" {
    ruby { code => "@save_the_date = event.get('DATE_BATCH')" }
} else {
    ruby { code => "event.set('DATE_BATCH', @save_the_date)" }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/method-to-timestamp-my-logstash-events/135888)._
