# Index CSV Timestamp

**URL:** https://discuss.elastic.co/t/index-csv-timestamp/324579
**Category:** Logstash
**Created:** [February 2, 2023, 9:30pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579 "2023-02-02T21:30:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![gabrile\_jaime\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabrile_jaime_gomez/32/116705_2.png) [@gabrile\_jaime\_gomez](https://discuss.elastic.co/u/gabrile_jaime_gomez)
#### Post date: [February 2, 2023, 9:30pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/1 "2023-02-02T21:30:52Z")

</div>

hello  
I want to index some csv files. I want to be indexed with the modification date, not with the date entered in Elastic.  
Example  
My file has a modification date of 01/23/2022, that is the date that I would like to see in Kibana. not today's date  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4cf3d8aa0de4c15bf8fa0b7b5033c44bd3c9df5a.png)

---

<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: [February 2, 2023, 9:32pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/2 "2023-02-02T21:32:45Z")

</div>

Do you have a column with date modification?

---

<div class="post-metadata">

### Author: ![gabrile\_jaime\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabrile_jaime_gomez/32/116705_2.png) [@gabrile\_jaime\_gomez](https://discuss.elastic.co/u/gabrile_jaime_gomez)
#### Post date: [February 2, 2023, 9:46pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/3 "2023-02-02T21:46:13Z")

</div>

The file itself doesn't have a date column, I want to index with the system date

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/2/52dc249ea3b2d451a519943d8f366b3d956216a1.png)

---

<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: [February 3, 2023, 12:17pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/4 "2023-02-03T12:17:00Z")

</div>

```auto
filter {

  ruby { 
    code => "	event.set('[@metadata][filedate]', File.mtime(event.get('[log][file][path]') ) ) "
  }
  
  mutate {copy => { "[@metadata][filedate]" => "@timestamp"}} 

}

```

---

<div class="post-metadata">

### Author: ![gabrile\_jaime\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabrile_jaime_gomez/32/116705_2.png) [@gabrile\_jaime\_gomez](https://discuss.elastic.co/u/gabrile_jaime_gomez)
#### Post date: [February 3, 2023, 12:22pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/5 "2023-02-03T12:22:18Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/3/c/3c55293c61be7f01f0dac4e0955185f685872e7e.png)  
this is my configuration file

---

<div class="post-metadata">

### Author: ![gabrile\_jaime\_gomez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabrile_jaime_gomez/32/116705_2.png) [@gabrile\_jaime\_gomez](https://discuss.elastic.co/u/gabrile_jaime_gomez)
#### Post date: [February 3, 2023, 12:55pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/6 "2023-02-03T12:55:47Z")

</div>

Thank you very much, what you sent me worked for me.

you are a guru

---

<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: [February 3, 2023, 1:06pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/7 "2023-02-03T13:06:11Z")

</div>

I have noticed, you are on Windows, change in input/file:  
` sincedb_path => "NUL"`

If something is not possible to achive in LS, there is Ruby always.

Guru? You should see Badger, he is the Jedi, collecting data from galaxies, shifting time, control space and much much more.

---

<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 3, 2023, 1:06pm UTC](https://discuss.elastic.co/t/index-csv-timestamp/324579/8 "2023-03-03T13:06:23Z")

</div>

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