Skip to content

Instantly share code, notes, and snippets.

@jordansissel
Created January 29, 2015 01:10
Show Gist options
  • Save jordansissel/33640925ec00caa724bd to your computer and use it in GitHub Desktop.
Save jordansissel/33640925ec00caa724bd to your computer and use it in GitHub Desktop.
% echo '{ "array": [ { "one": 1 }, { "two": 2 }, { "three": 3 } ] }' | bin/logstash -f test.conf
{
"one" => 1,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.813Z"
}
{
"two" => 2,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.814Z"
}
{
"three" => 3,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.814Z"
}
input { stdin { codec => json_lines } }
filter {
ruby {
init => "def filter(event, &block); event['array'].each { |o| yield LogStash::Event.new(o) }; event.cancel; end"
code => "hahaha"
}
}
output { stdout { codec => rubydebug } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment