# Create index for kube-system and rest of the namespaces another index

**URL:** <https://discuss.elastic.co/t/create-index-for-kube-system-and-rest-of-the-namespaces-another-index/290058>\
**Category:** Logstash\
**Created:** [November 24, 2021, 12:13pm UTC](https://discuss.elastic.co/t/create-index-for-kube-system-and-rest-of-the-namespaces-another-index/290058 "2021-11-24T12:13:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murali\_Thumalapalli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murali_thumalapalli/32/95165_2.png) [@Murali\_Thumalapalli](https://discuss.elastic.co/u/Murali_Thumalapalli)\
**Post date:** [November 24, 2021, 12:13pm UTC](https://discuss.elastic.co/t/create-index-for-kube-system-and-rest-of-the-namespaces-another-index/290058/1 "2021-11-24T12:13:02Z")

</div>

Hi Team, we are trying to create a new index for Kube-system namespace related logs as one index and rest of the system as another index.  
as part of that we have below spec read and deployed but we are not seeing any indexes getting created for kubesystem.  
Can someone please guide us.

This is what we have written to achieve it.

output {  
if [kubernetes][namespace] == "kube-system" {  
Elasticsearch {  
hosts =\> ["[http://xx-xxxx-xxx.io.thehut.local:9200](http://xx-xxxx-xxx.io.thehut.local:9200)"]  
index =\> "test-%{[kubernetes][namespace]}-%{+YYYY.MM.dd}"  
}  
} else {  
Elasticsearch {  
hosts =\> ["[http://xx-xx-xx-xx.io.thehut.local:9200](http://xx-xx-xx-xx.io.thehut.local:9200)""]  
index =\> "%{[@metadata][beat]}-%{[@metadata][version]}-%{+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:** [December 22, 2021, 12:13pm UTC](https://discuss.elastic.co/t/create-index-for-kube-system-and-rest-of-the-namespaces-another-index/290058/2 "2021-12-22T12:13:48Z")

</div>

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