# Elastic agent custom configuration to index in multiple indices

**URL:** <https://discuss.elastic.co/t/elastic-agent-custom-configuration-to-index-in-multiple-indices/366276>\
**Category:** Elasticsearch\
**Created:** [September 10, 2024, 2:20am UTC](https://discuss.elastic.co/t/elastic-agent-custom-configuration-to-index-in-multiple-indices/366276 "2024-09-10T02:20:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhi\_Abhishek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhi_abhishek/32/101426_2.png) [@Abhi\_Abhishek](https://discuss.elastic.co/u/Abhi_Abhishek)\
**Post date:** [September 10, 2024, 2:20am UTC](https://discuss.elastic.co/t/elastic-agent-custom-configuration-to-index-in-multiple-indices/366276/1 "2024-09-10T02:20:41Z")

</div>

Hi All,

I am trying to index data into different indices in kubernetes integration, based on the container logs,

```auto
output.elasticsearch:
  indices:
    - index: "test-analytics-%{+yyyy.MM}"
      when.contains:
        kubernetes.container.name: "keyahead-api"
    - index: "test-llm-api-logs-%{[kubernetes.container.name]}-%{+yyyy.MM}"
      when.equals:
        kubernetes.container.name: "llminsights-api"

```

by adding the above settings in the custom configuration in Kubernetes integration similar to the filebeat settings on elastic-agent policy but its not creating a different indices as expected. So please help me to solve this how I can index into different indices on elastic agent configuration.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/2/8284b43d95512586544eab8c1c6c0fe8a1171261.png)

With Regards,  
Abhishek M

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [September 10, 2024, 3:51am UTC](https://discuss.elastic.co/t/elastic-agent-custom-configuration-to-index-in-multiple-indices/366276/2 "2024-09-10T03:51:40Z")

</div>

Hello,

Yeah, this does not work for Fleet Managed agents, you cannot change the output this way.

The output will always follow the [data stream naming scheme](https://www.elastic.co/guide/en/fleet/current/data-streams.html) for the integrations.

You cannot have custom index names when using Fleet Managed agents.

Maybe you can do that if you use [Standalone agents](https://www.elastic.co/guide/en/fleet/current/elastic-agent-configuration.html) where you need to manage everything locally.
