Skip to content

Instantly share code, notes, and snippets.

@meetme2meat
Last active June 24, 2016 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meetme2meat/be553ccaa9155ab30db37b28217fb8bc to your computer and use it in GitHub Desktop.
Save meetme2meat/be553ccaa9155ab30db37b28217fb8bc to your computer and use it in GitHub Desktop.
The following is a logstash filter conf for zeromq
input {
stdin {
}
}
filter {
zeromq {
address => "tcp://127.0.0.1:8080"
mode => "client"
}
}
## zeromq filter plugin
filter {
## If the zeromq tag is present then added a type as matched
## this is just and example obviously one can add the type tag in ruby itself
## over here https://gist.github.com/meetme2meat/352b1a33306d9a8f157f2d61cbd101f4#file-logstash-rb-L28.
if ([zeromq]) {
mutate {
add_field => {
"type" => "matched"
}
}
}
## if the zeromq tag is not present than add a type 'non_matched'
else {
mutate {
add_field => {
"type" => "not_matched"
}
}
}
}
output {
stdout {
codec => 'rubydebug'
}
}
## confirm the above logstash configuration
# logstash -f logstash.conf --configtest
## Load the logstash with the following configuration
# logstash -f logstash.conf
## Start the following ruby application on seperate terminal
## https://gist.github.com/meetme2meat/352b1a33306d9a8f157f2d61cbd101f4
# ruby logstash.rb
## Note you need zeromq to be compiled and installed on your machine for this example to run successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment