Created
September 10, 2013 22:21
-
-
Save amitu/6516581 to your computer and use it in GitHub Desktop.
Dummy plugin for logstash.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin { | |
type => "foo" | |
} | |
} | |
filter { | |
if [type] == "foo" { | |
foo { | |
message => "Hello world!" | |
} | |
} | |
} | |
output { | |
stdout { | |
codec => "json" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 'logstash/filters/foo.rb' | |
require "logstash/filters/base" | |
require "logstash/namespace" | |
class LogStash::Filters::Foo < LogStash::Filters::Base | |
config_name "foo" | |
milestone 1 | |
config :message, :validate => :string | |
public | |
def register | |
end | |
public | |
def filter(event) | |
return unless filter?(event) | |
if @message | |
event["message"] = "werwer" | |
event["bar"] = "123123" | |
end | |
filter_matched(event) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ops java -jar logstash-1.2.1-flatjar.jar agent --config debug.conf --pluginpath . | |
Using milestone 1 filter plugin 'foo'. This plugin should work, but would benefit from use by folks like you. Please let us know if you find bugs or have suggestions on how to improve this plugin. For more information on plugin milestones, see http://logstash.net/docs/1.2.1/plugin-milestones {:level=>:warn} | |
Using milestone 1 codec plugin 'json'. This plugin should work, but would benefit from use by folks like you. Please let us know if you find bugs or have suggestions on how to improve this plugin. For more information on plugin milestones, see http://logstash.net/docs/1.2.1/plugin-milestones {:level=>:warn} | |
foo | |
{"message":"werwer","@timestamp":"2013-09-10T22:20:16.478Z","@version":"1","type":"foo","host":"pakichika.local","bar":"123123"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment