# If \[type\] is not working in logstash 2.3.2

**URL:** <https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181>\
**Category:** Logstash\
**Created:** [June 28, 2016, 4:57pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181 "2016-06-28T16:57:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasumathy](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@vasumathy](https://discuss.elastic.co/u/vasumathy)\
**Post date:** [June 28, 2016, 4:57pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/1 "2016-06-28T16:57:30Z")

</div>

input {  
jdbc {  
type =\> "deploymaster"  
jdbc\_driver\_library =\> ""  
jdbc\_driver\_class =\> ""  
jdbc\_connection\_string =\> ""  
jdbc\_user =\> ""  
jdbc\_password =\> ""  
statement =\> ""  
}  
}  
output {  
if [type] == "deploymaster"{  
elasticsearch { hosts =\> ["localhost:9200"]  
index =\> "metricslog"  
}  
}  
}

The type option is also not working. I am not able to see the output in elastic search

Note:  
Although i solved the problem of using multiple inputs and outputs in single logstash conf file by taking advantage of "tags" i want to know why "type" option is not working in logstash\_2.3.2

---

<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:** [June 29, 2016, 6:08am UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/2 "2016-06-29T06:08:01Z")

</div>

This should work. What if you remove some complexity and replace the elasticsearch output with a simple `stdout { codec => rubydebug }` output? And maybe replace the jdbc input with a stdin input? Divide and conquer!

---

<div class="post-metadata">

**Author:** ![vasumathy](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@vasumathy](https://discuss.elastic.co/u/vasumathy)\
**Post date:** [June 29, 2016, 5:26pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/3 "2016-06-29T17:26:22Z")

</div>

Thank you for your reply. If i remove the "type" check in the output everything works fine. So i do not think having JDBC or Elastic Search is a problem here. Let me know if I am right.

---

<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:** [June 29, 2016, 6:38pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/4 "2016-06-29T18:38:18Z")

</div>

I don't do hypothetical questions. I can only help if you answer my questions.

---

<div class="post-metadata">

**Author:** ![Dmitry2](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@Dmitry2](https://discuss.elastic.co/u/Dmitry2)\
**Post date:** [May 18, 2017, 9:02pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/5 "2017-05-18T21:02:08Z")

</div>

The same sh\*t for me! Spend several hours, dumped the port traffic to find out the reason. The config is:  
input {  
beats {  
port =\> 5047  
codec =\> "json"  
type =\> "my-debug"  
}  
}  
output {  
if [type] == "my-debug" {  
stdout { codec =\> rubydebug }  
}  
}  
If I remove "if" all works fine. Logstash is 2.2.2

---

<div class="post-metadata">

**Author:** ![Dmitry2](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@Dmitry2](https://discuss.elastic.co/u/Dmitry2)\
**Post date:** [May 18, 2017, 9:17pm UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/6 "2017-05-18T21:17:26Z")

</div>

Suddenly:  
The Beats shipper automatically sets the type field on the event. You cannot override this setting in the Logstash config. If you specify a setting for the type config option in Logstash, it is ignored.  
[https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html#plugins-inputs-beats-type](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html#plugins-inputs-beats-type)

This worked for me:  
input {  
beats {  
port =\> 5047  
codec =\> "json"  
tags =\> ["my-debug"]  
}  
}  
output {  
if "my-debug" in [tags] {  
stdout { codec =\> rubydebug }  
}  
}

Simplest task. Simplest condition. I just want to say: #@%&\* developers!!!

---

<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:** [July 6, 2017, 4:26am UTC](https://discuss.elastic.co/t/if-type-is-not-working-in-logstash-2-3-2/54181/7 "2017-07-06T04:26:29Z")

</div>


