Skip to content

Instantly share code, notes, and snippets.

@cjlyons81
cjlyons81 / json-to-event.rb
Last active Dec 6, 2019
Ruby filter for parsing json and adding to event in a Logstash pipeline
View json-to-event.rb
# ruby {
# path => "/etc/logstash/ancillary/ruby-scripts/json-to-event.rb" <--Example path to ruby file, be sure to update with yours
# script_params => {
# "json_field" => "notes" <--Specify the field you want to extract json from (default: message)
# "array" => true <--Do you want to flatten arrays within the json (default: false)
# "target" => "parent" <--Specify root level name if wanted (default: root of document)
# "tag_match_failure" => true <--Do you want to tag event when json regex match fails (defaults: false)
# }
# }