# Create an index with log.file.path field

**URL:** https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789
**Category:** Beats
**Tags:** filebeat
**Created:** [May 8, 2020, 7:43pm UTC](https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789 "2020-05-08T19:43:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Burak\_Cayir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burak_cayir/32/44575_2.png) [@Burak\_Cayir](https://discuss.elastic.co/u/Burak_Cayir)
#### Post date: [May 8, 2020, 7:43pm UTC](https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789/1 "2020-05-08T19:43:03Z")

</div>

Hello , Is it possible to create an index in Filebeat ? My example config doesn't work :

```auto
output.elasticsearch:
  hosts: ["https://localhost:9200"]
  index: "%{[log.file.path]}"

```

---

<div class="post-metadata">

### Author: ![Burak\_Cayir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burak_cayir/32/44575_2.png) [@Burak\_Cayir](https://discuss.elastic.co/u/Burak_Cayir)
#### Post date: [May 8, 2020, 8:14pm UTC](https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789/2 "2020-05-08T20:14:49Z")

</div>

By the way elasticsearch doesn't allow "/" char for index name. I think this is my problem. How can I parse this field and take filename ?

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [May 10, 2020, 1:34pm UTC](https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789/3 "2020-05-10T13:34:23Z")

</div>

Hey @Burak_Cayir,

I don't think there is a way to parse the filename at this point. Is there any other field you could use?

By the way, I am curious, why would you like to use an index per file? It is usually not recommended to have many small indexes.

---

<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: [June 7, 2020, 1:34pm UTC](https://discuss.elastic.co/t/create-an-index-with-log-file-path-field/231789/4 "2020-06-07T13:34:26Z")

</div>

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