# Create Index Name in Logstash based on event fields

**URL:** <https://discuss.elastic.co/t/create-index-name-in-logstash-based-on-event-fields/209443>\
**Category:** Logstash\
**Created:** [November 26, 2019, 8:07am UTC](https://discuss.elastic.co/t/create-index-name-in-logstash-based-on-event-fields/209443 "2019-11-26T08:07:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Becker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simon_becker/32/87100_2.png) [@Simon\_Becker](https://discuss.elastic.co/u/Simon_Becker)\
**Post date:** [November 26, 2019, 8:07am UTC](https://discuss.elastic.co/t/create-index-name-in-logstash-based-on-event-fields/209443/1 "2019-11-26T08:07:43Z")

</div>

Hello,

i try to create an index name based on fields I added in my beat.yml.  
I added a customer field in my beats.yml:

> processors:  
> - add\_fields:  
> target: customer  
> fields:  
> name: testcustomer

Now I would like to create the index name based on the customer field in logstash:

` index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"`  
How can I add the field to the index name, I tried it with  
`%{customer.name}` and `%{[customer][name]},`  
but it wasnt working at all.

It would help me a lot if someone could help me out here 🙂

---

<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 24, 2019, 8:07am UTC](https://discuss.elastic.co/t/create-index-name-in-logstash-based-on-event-fields/209443/2 "2019-12-24T08:07:45Z")

</div>

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