Add "type" to my custom input plugin


(Itzik Hanoch) #1

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?


(Magnus Bäck) #2

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.


(Itzik Hanoch) #3

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>>,


(Magnus Bäck) #4

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


(system) #5

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