# Not able to index timestamp from input filename

**URL:** https://discuss.elastic.co/t/not-able-to-index-timestamp-from-input-filename/176474
**Category:** Logstash
**Created:** [April 11, 2019, 6:38pm UTC](https://discuss.elastic.co/t/not-able-to-index-timestamp-from-input-filename/176474 "2019-04-11T18:38:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Kalyan\_MB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kalyan_mb/32/42974_2.png) [@Kalyan\_MB](https://discuss.elastic.co/u/Kalyan_MB)
#### Post date: [April 11, 2019, 6:38pm UTC](https://discuss.elastic.co/t/not-able-to-index-timestamp-from-input-filename/176474/1 "2019-04-11T18:38:03Z")

</div>

Hi,

input file name format: free\_data\_09\_09\_18\_10.txt \<free\_data\_date\_month\_hour\_min\>

i want this time stamp also to be indexed along with input file data, trying with below logstash filter config which is not working as expected any suggestions?

* * *

input {  
beats {  
port =\> 5044  
}  
}

filter {

grok { match =\> { "someField" =\> "free\_data\_(?[0-9\_]+).txt" } }  
date { match =\> ["ts", "dd\_MM\_HH\_mm"] }  
if [message] =~ /Mem:/ {  
dissect { mapping =\> {'message' =\> '%{mem\_type-\>} %{total\_mem-\>} %{used\_mem-\>} %{free\_mem-\>} %{shared\_mem-\>} %{cache\_mem-\>} %{availablemem}'} }  
} else if [message] =~ /Swap:/ {  
dissect { mapping =\> {'message' =\> '%{mem\_type-\>} %{total\_mem-\>} %{used\_mem-\>} %{free\_mem-\>}'} }  
}

}

## output { if [service\_name] == "cfx" { elasticsearch { #path =\> "/var/log/sdl\_logs/%{vnf\_id}/%{vm\_type}/%{instance\_id}/%{service\_name}/%{app\_name}\_%{+yyyy-MM-dd-HH}.log" #codec =\> line { format =\> "%{message}" } #gzip =\> true hosts =\> ["[http://x.x.x.x:9200](http://x.x.x.x:9200)"] index =\> "freedata"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a4c57fbbdc56d30985035ff68104a44b5b98f825.png)

---

<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: [May 9, 2019, 6:38pm UTC](https://discuss.elastic.co/t/not-able-to-index-timestamp-from-input-filename/176474/2 "2019-05-09T18:38:03Z")

</div>

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