# Change elastic's index name to a kubernetes pod label

**URL:** <https://discuss.elastic.co/t/change-elastics-index-name-to-a-kubernetes-pod-label/314324>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 13, 2022, 6:03pm UTC](https://discuss.elastic.co/t/change-elastics-index-name-to-a-kubernetes-pod-label/314324 "2022-09-13T18:03:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Gonzalez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivan_gonzalez/32/40341_2.png) [@Ivan\_Gonzalez](https://discuss.elastic.co/u/Ivan_Gonzalez)\
**Post date:** [September 13, 2022, 6:03pm UTC](https://discuss.elastic.co/t/change-elastics-index-name-to-a-kubernetes-pod-label/314324/1 "2022-09-13T18:03:53Z")

</div>

Hi guys.

I am migrating from fluentbit to filebeat to ship logs from kubernetes to graylog 4.

The idea is to create 'graylog-application\_name' indexes to let me know identify properly which data holds each index.  
As far as I read in the doc, it is possible to change the elastic's index name.  
The example in the doc ([here](https://www.elastic.co/guide/en/beats/filebeat/8.4/change-index-name.html)) mentions "customname-%{[agent.version]}" but I want to use the value of the label [app.kubernetes.io/instance](http://app.kubernetes.io/instance).

I mean, the pod has:

```auto
  label:
     app.kubernetes.io/instance: my_app_name

```

and I want the logs of that pod be indexed in an index named _'graylog-my\_app\_name'_

I have been trying to find an example on how to use the kubernetes metadata as variables in the config (and wondering if I have to dedot the label [app.kubernetes.io/instance](http://app.kubernetes.io/instance), including the / character).  
Unfortunatelly I was not able to find any example or documentation in the last two days.

Anyone knows how to access to the kubernetes metadata to use it in the config and how to proceed to set the index name using the label name?

Any insight is welcome  
Thanks in advance

---

<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:** [October 11, 2022, 8:04pm UTC](https://discuss.elastic.co/t/change-elastics-index-name-to-a-kubernetes-pod-label/314324/2 "2022-10-11T20:04:25Z")

</div>

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