# To set an index name with filebeat

**URL:** <https://discuss.elastic.co/t/to-set-an-index-name-with-filebeat/239397>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [July 1, 2020, 3:16am UTC](https://discuss.elastic.co/t/to-set-an-index-name-with-filebeat/239397 "2020-07-01T03:16:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jang](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jang](https://discuss.elastic.co/u/jang)\
**Post date:** [July 1, 2020, 3:16am UTC](https://discuss.elastic.co/t/to-set-an-index-name-with-filebeat/239397/1 "2020-07-01T03:16:16Z")

</div>

hello,  
I pass the log to logstash via Filebit.  
I currently collect logs from **three path**.  
I'm trying to set index name on the filebit.  
I want to set an index name for each path.  
How can I set each index name?

**now setting**

```auto
filebeat.inputs:

  - type: log
    enabled: true
    paths:
      - C:\Temp\test1.log
      - C:\Temp\test2.log
      - C:\Temp\test3.log

output.logstash:
  hosts: ["address:5044"]
  index: "test1"

```

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [July 2, 2020, 5:25am UTC](https://discuss.elastic.co/t/to-set-an-index-name-with-filebeat/239397/2 "2020-07-02T05:25:43Z")

</div>

Hello,

Welcome to this forum. As you are sending the logs to LogStash FileBeat does not know about ElasticSearch and cannot set the index.

Basically, if you want to create different indexes based on the paths test1.log, test2.log, test3.log you could:

1. Map the paths received from FileBeat to the index name using a LogStash filter.
2. Depending on the fact if you use ILM or not you can either set the [index or ILM settings](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-index) to contain the generated index name.

[Here](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#_writing_to_different_indices_best_practices) is a good description.

Best regards  
Wolfram

---

<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 30, 2020, 7:25am UTC](https://discuss.elastic.co/t/to-set-an-index-name-with-filebeat/239397/3 "2020-07-30T07:25:44Z")

</div>

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