# How to put each file name as index name to store Elasticsearch via Filebeat

**URL:** https://discuss.elastic.co/t/how-to-put-each-file-name-as-index-name-to-store-elasticsearch-via-filebeat/319755
**Category:** Beats
**Tags:** filebeat
**Created:** [November 24, 2022, 12:48pm UTC](https://discuss.elastic.co/t/how-to-put-each-file-name-as-index-name-to-store-elasticsearch-via-filebeat/319755 "2022-11-24T12:48:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Furkan\_Gulseren](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@Furkan\_Gulseren](https://discuss.elastic.co/u/Furkan_Gulseren)
#### Post date: [November 24, 2022, 12:48pm UTC](https://discuss.elastic.co/t/how-to-put-each-file-name-as-index-name-to-store-elasticsearch-via-filebeat/319755/1 "2022-11-24T12:48:50Z")

</div>

Hello,

How can I put each filename as index name to store elasticsearch via filebeat?

i am using Filebeat to send log files to elasticsearch via logstash conf. i am using wildcard(\*) to get all of the files in directories.

Now it works like all of my logs stored one index in Elasticsearch and i don't want this. I need separately indexing for each log file.

Filebeat harvester is processing all of my files in the directories but I need the filename of my logs separately to index\_name to store elasticsearch via logstash conf file. I can't put each processed log file name to conf file output.elasticsearch.index\_name.

I think this should be possible because i have seen the exact path for each file(and of course file\_name) both logstash logs([log.file.path]) and filebeat logs(called source\_file). When i put that index name in the format of %{[]}, it doesn't give me dynamic value, just storing what i wrote for index name...

I have already tried these difference approaches:  
index =\> "%{[@metadata][log.file.path]}-%{[log.file.path]}-%{[source\_file]}"

wildcard path  
filebeat.yml:

 ![filebeat.yml](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dca617712cbcfe6d9178a43955e89971ee0fe21b.png)

logstash conf file:

 ![logstash conf](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4cb9df19a052ef11e258a78502dd3b6d8aadf224.jpeg)

Thanks in advance!

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 30, 2022, 12:48am UTC](https://discuss.elastic.co/t/how-to-put-each-file-name-as-index-name-to-store-elasticsearch-via-filebeat/319755/2 "2022-11-30T00:48:44Z")

</div>

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

---

<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: [December 28, 2022, 2:49am UTC](https://discuss.elastic.co/t/how-to-put-each-file-name-as-index-name-to-store-elasticsearch-via-filebeat/319755/3 "2022-12-28T02:49:13Z")

</div>

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