# How to get creation timestamp of input file

**URL:** https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533
**Category:** Logstash
**Created:** [March 25, 2023, 11:44pm UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533 "2023-03-25T23:44:36Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Zak1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zak1/32/118952_2.png) [@Zak1](https://discuss.elastic.co/u/Zak1)
#### Post date: [March 25, 2023, 11:44pm UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/1 "2023-03-25T23:44:36Z")

</div>

Am using logstash to parse an input logfile and subsequently sends data to elasticsearch. I would like to capture the creation date/timestamp of the input logfile as a field on the event. How best to go about this? Fyi, i've very new to using logstash. Thnx

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [March 28, 2023, 9:35am UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/2 "2023-03-28T09:35:39Z")

</div>

As far as I know that is not possible.

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [March 29, 2023, 8:04am UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/3 "2023-03-29T08:04:11Z")

</div>

You should use ruby, a similar sample is [here](https://discuss.elastic.co/t/index-csv-timestamp/324579/3)

---

<div class="post-metadata">

### Author: ![Zak1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zak1/32/118952_2.png) [@Zak1](https://discuss.elastic.co/u/Zak1)
#### Post date: [March 30, 2023, 11:35am UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/4 "2023-03-30T11:35:50Z")

</div>

very nice, thankyou @Rios

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [March 31, 2023, 4:54am UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/5 "2023-03-31T04:54:48Z")

</div>

In general, you have OOB filter plugins, if they support your requirements like data parsing(for instance grok or csv) you can in it used it. For any other things, there is ruby plugin which opens a new world of endless possibilities.  
So, Christian is correct, it's not possible by default-there is no plugin or property, but with ruby it's not so complex.

---

<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: [April 28, 2023, 4:55am UTC](https://discuss.elastic.co/t/how-to-get-creation-timestamp-of-input-file/328533/6 "2023-04-28T04:55:34Z")

</div>

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