filter {
ruby {
path => "${PWD}/precision-timestamp-parse.logstash-filter-ruby.rb"
script_params => {
source => "precise-timestamp-field"
format => "ISO8601"
}
}
}
This file contains hidden or 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
| ╭─{ yaauie@limbo:~/src/elastic/ls (✔ 8.0) } | |
| ╰─● (rbenv shell jruby-9.2.19.0; ruby kwargs-splat.rb) | |
| ArgumentError: wrong number of arguments calling `initialize` (given 1, expected 0) | |
| new at kwargs-splat.rb:7 | |
| <main> at kwargs-splat.rb:17 | |
| ( rbenv shell jruby-9.2.19.0; ruby kwargs-splat.rb; ) 9.23s user 0.53s system 405% cpu 2.412 total | |
| [error: 1] |
This file contains hidden or 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
| ############################################################################### | |
| # json-sanitize-field-names.logstash-filter-ruby.rb | |
| # --------------------------------- | |
| # A script for a Logstash Ruby Filter to transform a JSON string so that the | |
| # resulting JSON string's decoded representation does not contain square | |
| # brackets in keys. | |
| # | |
| # This filter does NOT parse the JSON string into an Object, and has undefined | |
| # behaviour when the string is not valid JSON. | |
| # |
This file contains hidden or 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
| diff --git a/logstash-core/logstash-core.gemspec b/logstash-core/logstash-core.gemspec | |
| index e22a9f289..a4563498a 100644 | |
| --- a/logstash-core/logstash-core.gemspec | |
| +++ b/logstash-core/logstash-core.gemspec | |
| @@ -78,4 +78,8 @@ Gem::Specification.new do |gem| | |
| gem.add_dependency 'down', '~> 5.2.0' #(MIT license) | |
| gem.add_dependency 'tzinfo-data' #(MIT license) | |
| gem.add_dependency 'rufus-scheduler' #(MIT license) | |
| + | |
| + # TEMPORARY: racc-1.6.0 doesn't have JAVA counterpart (yet) |
This file contains hidden or 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
| ############################################################################### | |
| # transform-field-names.logstash-filter-ruby.rb | |
| # --------------------------------- | |
| # A script for a Logstash Ruby Filter to transform field names, possibly | |
| # recursively. | |
| ############################################################################### | |
| # | |
| # Copyright 2020 Ry Biesemeyer | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains hidden or 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
| ############################################################################### | |
| # estimate-serialized-size.logstash-filter-ruby.rb | |
| # --------------------------------- | |
| # A script for a Logstash Ruby Filter to estimate the serialized size of an | |
| # event or one of its fields. | |
| ############################################################################### | |
| # | |
| # Copyright 2021 Ry Biesemeyer | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy |
This file contains hidden or 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
| require 'time' # Time#iso8601 | |
| # A NoisyProxy will log all method calls on the wrapped object and their results to the given IO. | |
| # It will optionally _infect_ any object returned by the real method. | |
| class NoisyProxy < BasicObject | |
| def initialize(inner, infect:false, io:$stderr) | |
| @inner = inner | |
| @infect = infect | |
| @io = io | |
| end |
Suppose you had events with the following structure:
{
"books": [
{"author":"Alice", "title":"Fields" },
{"author":"Bob", "title":"Oceans" },
{"author":"Connie", "title":"Rivers" },
{"author":"Connie", "title":"Lakes" },
{"author":"David", "title":"Streams"},This script has three parameters:
source: a field reference to the source arraytarget: a field reference to the target arraycoerce: (optional: defaultfalse) when encountering non-array values in either source or target fields, settingcoerce => truecauses these fields to first be converted to a single-entry array.
filter {
This file contains hidden or 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
| diff --git a/lib/logstash/codecs/csv.rb b/lib/logstash/codecs/csv.rb | |
| index 07d6416..66cd6ed 100644 | |
| --- a/lib/logstash/codecs/csv.rb | |
| +++ b/lib/logstash/codecs/csv.rb | |
| @@ -133,12 +133,19 @@ class LogStash::Codecs::CSV < LogStash::Codecs::Base | |
| rescue CSV::MalformedCSVError => e | |
| @logger.error("CSV parse failure. Falling back to plain-text", :error => e, :data => data) | |
| yield LogStash::Event.new("message" => data, "tags" => ["_csvparsefailure"]) | |
| end | |
| end |