# \[closed\]Logstash output with "else-if" not working

**URL:** https://discuss.elastic.co/t/closed-logstash-output-with-else-if-not-working/177509
**Category:** Logstash
**Created:** [April 18, 2019, 4:04pm UTC](https://discuss.elastic.co/t/closed-logstash-output-with-else-if-not-working/177509 "2019-04-18T16:04:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lgwapnitsky](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lgwapnitsky/32/42919_2.png) [@lgwapnitsky](https://discuss.elastic.co/u/lgwapnitsky)
#### Post date: [April 18, 2019, 4:04pm UTC](https://discuss.elastic.co/t/closed-logstash-output-with-else-if-not-working/177509/1 "2019-04-18T16:04:14Z")

</div>

I'm tagging my cloudflare data in the http\_poller input in logstash. I have the following config in my output file, but the cf section is getting skipped and going right to the last stanza, writing the wrong index name

> output {  
> if "azeh" in [tags] {  
> if [AppEnvironment] {  
> elasticsearch {  
> index =\> "tn-%{AppEnvironment}-%{LoggerName}-%{+YYYY.MM.dd}"  
> hosts =\> ["10.10.9.4:9200"]  
> }  
> }  
> else {  
> elasticsearch {  
> index =\> "tn-%{LoggerName}-%{+YYYY.MM.dd}"  
> hosts =\> ["10.10.9.4:9200"]  
> }  
> }  
> }
> 
> else if "cloudflare" in [tags] {  
> elasticsearch {  
> index =\> "cloudflare-%{+YYYY.MM.dd}"  
> hosts =\> ["10.10.9.4:9200"]  
> }  
> }
> 
> else {  
> elasticsearch {  
> hosts =\> ["10.10.9.4:9200"]  
> index =\> "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"  
> }  
> }  
> }

the output in elasticsearch can be seen here:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7c07df544015c0d8f7bc3e535056b32fe8c681a5.png)

All other tag-based index renames are working, save for this one.

Please advise.

Thank you

---

<div class="post-metadata">

### Author: ![lgwapnitsky](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lgwapnitsky/32/42919_2.png) [@lgwapnitsky](https://discuss.elastic.co/u/lgwapnitsky)
#### Post date: [April 18, 2019, 4:26pm UTC](https://discuss.elastic.co/t/closed-logstash-output-with-else-if-not-working/177509/2 "2019-04-18T16:26:55Z")

</div>

Nevermind - rouge process was stealing/overwriting my configs. all working now

---

<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: [May 16, 2019, 4:26pm UTC](https://discuss.elastic.co/t/closed-logstash-output-with-else-if-not-working/177509/3 "2019-05-16T16:26:57Z")

</div>

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