# How to create container name specific indexes

**URL:** https://discuss.elastic.co/t/how-to-create-container-name-specific-indexes/338766
**Category:** Logstash
**Tags:** docker
**Created:** [July 19, 2023, 10:42am UTC](https://discuss.elastic.co/t/how-to-create-container-name-specific-indexes/338766 "2023-07-19T10:42:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Affan\_Mir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/affan_mir/32/123647_2.png) [@Affan\_Mir](https://discuss.elastic.co/u/Affan_Mir)
#### Post date: [July 19, 2023, 10:42am UTC](https://discuss.elastic.co/t/how-to-create-container-name-specific-indexes/338766/1 "2023-07-19T10:42:51Z")

</div>

I've deployed filebeat as a daemonset now for every container I need to access to their respective container names and read them from logstash so I can have indexes like 'container-name-YYYY-MM-DD' in my Elasticsearch.

These are my config files for both filebeat and logstash

```auto
filebeat.inputs:
- type: container
  stream: stdout
  paths:
    - /var/log/containers/*.log
  processors:
    - add_docker_metadata: ~
  #- add_kubernetes_metadata:
  # host: ${NODE_NAME}
  # matchers:
  # - logs_path:
  # logs_

```

```auto
output {
  elasticsearch {
  
    index => "%{[docker][container][name]}-%{+YYYY.MM.dd}"}}

```

---

<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: [August 16, 2023, 10:43am UTC](https://discuss.elastic.co/t/how-to-create-container-name-specific-indexes/338766/2 "2023-08-16T10:43:10Z")

</div>

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