# Conditional Output Not Working

**URL:** <https://discuss.elastic.co/t/conditional-output-not-working/87477>\
**Category:** Logstash\
**Created:** [May 29, 2017, 4:10pm UTC](https://discuss.elastic.co/t/conditional-output-not-working/87477 "2017-05-29T16:10:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjmaynard01](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bjmaynard01/32/26112_2.png) [@bjmaynard01](https://discuss.elastic.co/u/bjmaynard01)\
**Post date:** [May 29, 2017, 4:10pm UTC](https://discuss.elastic.co/t/conditional-output-not-working/87477/1 "2017-05-29T16:10:58Z")

</div>

I have come across an interesting problem that is causing me to bash my head against the wall. I'm trying to parse nginx access logs and eventually dump them into ES. However, for testing purposes, I am using stdout. in the below config, when I remove the conditional for [id] I get output to stdout as expected. But when I configure it with a conditional, as will be needed for indexing, no output is generated.

The input is:  
`
input {
syslog {
port => 2359
id => "cookbook_access"
type => "nginx_access"
host => "XXX.XXX.XXX.XXX"
timezone => "American/New_York"
}
}
`  
Now, when I use this as the output, I get output generated, as expected.  
`
stdout {
codec => rubydebug
}
`  
However, when I change the output to be  
`
if [id] == "cookbook_access" {
stdout {
codec => rubydebug
}
}
`  
No output is generated.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 29, 2017, 7:00pm UTC](https://discuss.elastic.co/t/conditional-output-not-working/87477/2 "2017-05-29T19:00:38Z")

</div>

The `id` option adds an identifier to the _plugin_. It won't attach an `id` field to each event processed by the input. You should probably be using the `type` or the `add_field` option instead.

---

<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:** [June 26, 2017, 7:00pm UTC](https://discuss.elastic.co/t/conditional-output-not-working/87477/3 "2017-06-26T19:00:46Z")

</div>

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