fluent-plugin-jsonl_array_splitter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 17836cb854c4c3bbd7de2d9b2dc088b084ca38a6
4
+ data.tar.gz: 401ba36950ee1ad014022a9e87ccf1c3387bbeb6
5
+ SHA512:
6
+ metadata.gz: 77329ebbcc0f4f96b005486f691cfb4c6d34961645382f037f991bbbe9f937394336ed851824a9ce8ec674087af9fa7fe114e0205438a4287ea1910d61b66d42
7
+ data.tar.gz: 8df89d1ee771aba499d120d3144ac23f60def31a09bcc0dc4102355db22cf37894dc1776387b2580b51a66fac6587088152c489116b8b0d9a9a0193d94524d01
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-jsonl_array_splitter.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Olivér Sz,
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ gem:
2
+ rm -f fluent-plugin-jsonl_array_splitter*.gem
3
+ gem build fluent-plugin-jsonl_array_splitter.gemspec
4
+
5
+ install: gem
6
+ gem install fluent-plugin-jsonl_array_splitter*.gem
7
+
8
+ push: gem
9
+ gem push fluent-plugin-jsonl_array_splitter*.gem
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-jsonl_array_splitter"
7
+ spec.version = "0.1.0"
8
+ spec.authors = ["Oliver Szabo"]
9
+ spec.email = ["oleewere@gmail.com"]
10
+ spec.description = %q{Fluentd filter plugin to split JSONL fomatted array text into multiple events}
11
+ spec.summary = %q{Fluentd filter plugin to split JSONL fomatted array text into multiple events}
12
+ spec.homepage = "https://github.com/oleewere/fluent-plugin-jsonl_array_splitter"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'fluentd', ['>= 0.14.0', '< 2']
21
+
22
+ spec.add_development_dependency "rake", ["~> 11.0"]
23
+ spec.add_development_dependency 'test-unit', '~> 3.3', '>= 3.3.3'
24
+ end
@@ -0,0 +1,45 @@
1
+ require 'json'
2
+
3
+ module Fluent
4
+ module Plugin
5
+ class JsonlArraySplitterFilter < Fluent::Plugin::Filter
6
+ Fluent::Plugin.register_filter("jsonl_array_splitter", self)
7
+
8
+ desc "Key name that contains JSONL formatted text"
9
+ config_param :key_name, :string
10
+ desc "Keep original key in parsed result."
11
+ config_param :reserve_key, :bool, default: false
12
+ desc 'Enable debug log. Default: false.'
13
+ config_param :debug, :bool, :default => false
14
+
15
+ def filter_stream(tag, es)
16
+ new_es = Fluent::MultiEventStream.new
17
+ es.each do |time, record|
18
+ record_lines = record[@key_name].to_s
19
+ parsed = []
20
+ record_lines.each_line do |line|
21
+ if @debug then
22
+ log.debug("Read JSON line: #{line}")
23
+ end
24
+ parsed << JSON.parse("#{line}")
25
+ end
26
+
27
+ parsed.each do |r|
28
+ new_record = record.clone
29
+ new_record.update(r)
30
+
31
+ if !@reserve_key then
32
+ new_record.delete(@key_name)
33
+ end
34
+ if @debug then
35
+ log.debug("New record by json line filter: #{new_record}")
36
+ end
37
+ new_es.add(time, new_record)
38
+ end
39
+ end
40
+ new_es
41
+ end
42
+ end
43
+ end
44
+ end
45
+
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-jsonl_array_splitter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Oliver Szabo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.14.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.14.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '11.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '11.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: test-unit
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.3'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.3.3
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '3.3'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.3.3
67
+ description: Fluentd filter plugin to split JSONL fomatted array text into multiple
68
+ events
69
+ email:
70
+ - oleewere@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - ".gitignore"
76
+ - Gemfile
77
+ - LICENSE
78
+ - Makefile
79
+ - fluent-plugin-jsonl_array_splitter.gemspec
80
+ - lib/fluent/plugin/filter_jsonl_array_splitter.rb
81
+ homepage: https://github.com/oleewere/fluent-plugin-jsonl_array_splitter
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.5.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Fluentd filter plugin to split JSONL fomatted array text into multiple events
105
+ test_files: []