# Read a date of a file to add this property in Logstash to send a ElasticSearch

**URL:** https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359
**Category:** Logstash
**Created:** [June 6, 2023, 2:13pm UTC](https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359 "2023-06-06T14:13:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AlejandroVindel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alejandrovindel/32/121901_2.png) [@AlejandroVindel](https://discuss.elastic.co/u/AlejandroVindel)
#### Post date: [June 6, 2023, 2:13pm UTC](https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359/1 "2023-06-06T14:13:03Z")

</div>

HI,  
I am collecting files with Logstash and sending them to an Elasticsearch database.  
But I'm running into the problem that I can't pick up the date that file was created or last modified. I'm working on Linux, and what I need is to know how to extract this field and send it to elastic.  
I have tried all sorts of filters in ruby ​​but end up seeing "%{data}" and not the output. There is a way to get this correctly?

---

<div class="post-metadata">

### Author: ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)
#### Post date: [June 27, 2023, 6:52pm UTC](https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359/2 "2023-06-27T18:52:44Z")

</div>

Hello @AlejandroVindel,

Welcome to the community!

Check if this [config](https://discuss.elastic.co/t/how-can-i-set-current-time-in-field/157542/3) makes sense for your use case.

Hope it helps!

---

<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: [June 28, 2023, 8:36am UTC](https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359/3 "2023-06-28T08:36:09Z")

</div>

Are you reading files by FB or LS?

If this doesn't help what Priscilla suggest, can you provide a sample, what you want?

---

<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: [July 26, 2023, 8:37am UTC](https://discuss.elastic.co/t/read-a-date-of-a-file-to-add-this-property-in-logstash-to-send-a-elasticsearch/335359/4 "2023-07-26T08:37:02Z")

</div>

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