# Add "type" to my custom input plugin

**URL:** <https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358>\
**Category:** Logstash\
**Created:** [January 31, 2017, 12:17pm UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358 "2017-01-31T12:17:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![itzikHan](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@itzikHan](https://discuss.elastic.co/u/itzikHan)\
**Post date:** [January 31, 2017, 12:17pm UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358/1 "2017-01-31T12:17:20Z")

</div>

Hi,

I'm trying to add "type" field that i would be able to use as tag when filtering to my input plugin.  
For example, I can add "type" in the 'file' input plugin, and filter it later.  
Code:

> input {  
> file {  
> path =\> "/var/log/%{type}.%{+yyyy.MM.dd.HH}"  
> **type =\> "myType"**  
> }  
> }

> filter {  
> **if [type] == "myType"**  
> ...  
> }

> output {  
> ...  
> }

I looked at the file input plugin implementation, and did not see any field related to the "type" field.

So i just tried to add it like this:

> input {  
> myPlugin {  
> path =\> "/var/log/%{type}.%{+yyyy.MM.dd.HH}"  
> **type =\> "myType"**  
> }  
> }

But the filtering did not work at all.

How can i add this "tag" (or whatever it is) to my plugin?

---

<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:** [February 1, 2017, 8:46pm UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358/2 "2017-02-01T20:46:34Z")

</div>

It sounds like your input plugin doesn't call `decorate()` on the event object before passing it to the output queue, but since you're not showing us your code we can only guess.

---

<div class="post-metadata">

**Author:** ![itzikHan](https://avatars.discourse-cdn.com/v4/letter/i/eb8c5e/32.png) [@itzikHan](https://discuss.elastic.co/u/itzikHan)\
**Post date:** [February 2, 2017, 8:46am UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358/3 "2017-02-02T08:46:36Z")

</div>

Thank you for the answer magnus, And you are correct, i do not call decorate because it crashes for some reason every time i call it.  
This is the error:

`[LogStash::Runner] FATAL logstash.runner - An unexpected error occurred! {:error=>#<NoMethodError: undefined method decorate for #<QueryExecuter:0xabb6bd>>,`

---

<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:** [February 2, 2017, 10:16am UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358/4 "2017-02-02T10:16:58Z")

</div>

I'm not going to continue debugging this without seeing the code.

---

<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:** [March 2, 2017, 10:17am UTC](https://discuss.elastic.co/t/add-type-to-my-custom-input-plugin/73358/5 "2017-03-02T10:17:30Z")

</div>

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