# Timestamp Event at Logstash Input

**URL:** <https://discuss.elastic.co/t/timestamp-event-at-logstash-input/296122>\
**Category:** Logstash\
**Created:** [February 2, 2022, 8:24pm UTC](https://discuss.elastic.co/t/timestamp-event-at-logstash-input/296122 "2022-02-02T20:24:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MakoWish](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@MakoWish](https://discuss.elastic.co/u/MakoWish)\
**Post date:** [February 2, 2022, 8:24pm UTC](https://discuss.elastic.co/t/timestamp-event-at-logstash-input/296122/1 "2022-02-02T20:24:44Z")

</div>

We are using Persistent Queues, and I would like to calculate the time an event is in queue before actually being sent through the pipeline, but in order to do so, I need to add a timestamp in the `input` section of the pipeline.

I have tried just copying `@timestamp`, and that works perfectly fine for TCP and UDP inputs, as the timestamp is added when the event is received. However, for Beats agent input, it seems the `@timestamp` field is written by the Beats agent itself, so that ruins the entire idea of calculating queue time.

How can we add a current timestamp to events when they hit the Logstash input, but _ **before** _ the event hits the queue?

Would appreciate any thoughts.

---

<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:** [March 2, 2022, 8:24pm UTC](https://discuss.elastic.co/t/timestamp-event-at-logstash-input/296122/2 "2022-03-02T20:24:50Z")

</div>

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