fluent-plugin-record_indexing 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b3c230a4fe0c5c4a6dd0b914c2728d1cd91e84c9702689628388278cba45dd
4
- data.tar.gz: 818543e3a427d6e14a6a7acea3753b0bbe94117df54951dcfe53ebfbbd09a4bf
3
+ metadata.gz: cda0290a81edfabb93f0dc7739dc1889c2e7f599b3ee674c0baaffebfb7d2a7d
4
+ data.tar.gz: 0b9a9a50bc274c4e1c2aef91482bbbb7c7ea3e0c047dc5fe192735cc03623765
5
5
  SHA512:
6
- metadata.gz: afa2cc12fcbea30b784488c3efff17baf83cb9bde31922723f5986fc35b8fc068491bdf11e10c91b8d8012871cb252cc6a9e97db4c893469cfda9c8e6d468625
7
- data.tar.gz: d4883c2c3c9c1d7adeb11e08cf5d0dc8365f92a861530aa1e4776c2aee6fa47ff5a37fd0236e5b7d8b18fa02a473581d26e36f6c17fcd19dd66a8874d8b411fb
6
+ metadata.gz: 196d17bfa5b24665b6e1a4d2bda1d0b100032dc30fa6da1e91ed9567444ec8d99a4224daf1df4135e1a5e97dc90d1b2d7494df96639bc82372f44f7eb6fdbc75
7
+ data.tar.gz: 5831f0607dfb888932a4d7476a7e8bb1fd247a2c3e82a1e0a34b0a0cae77276715b579579d3723cb42d2f0f6bad5d5602cd296ba66e585ad4e4056374c341fd8
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # fluent-plugin-record_indexing
2
2
 
3
- [Fluentd](https://fluentd.org/) Filter plugin to spin entry with an array field into multiple entries.
3
+ [Fluentd](https://www.fluentd.org) Filter plugin to spin entry with an array field into multiple entries.
4
4
 
5
5
  ## Examples
6
6
  ```
7
7
  <filter test**>
8
8
  @type record_indexing
9
9
  check_all_key false
10
- key_name baz
10
+ key_names baz
11
11
  key_prefix baz_0
12
12
  </filter>
13
13
 
@@ -20,7 +20,7 @@ Out:
20
20
  <filter test**>
21
21
  @type record_indexing
22
22
  check_all_key false
23
- key_name baz
23
+ key_names baz
24
24
  </filter>
25
25
 
26
26
  In:
@@ -39,13 +39,36 @@ In:
39
39
  Out:
40
40
  {"foo"=>"bar", "baz"=>{"0"=>{"a"=>1} , "1"=>{"a"=>2}, "2"=>{"b"=>3}}, "daz"=>{"0"=>{"a"=>1} , "1"=>{"a"=>2}, "2"=>{"b"=>3}}}
41
41
  ```
42
+ ```
43
+ <filter test**>
44
+ @type record_indexing
45
+ check_all_key false
46
+ key_names baz,daz
47
+ </filter>
48
+
49
+ In:
50
+ {"foo" => "bar", "baz"=>[{"a"=>1}, {"a"=>2}, {"b"=>3}] , "daz" => [{"a"=>1}, {"a"=>2}, {"b"=>3}]}
51
+ Out:
52
+ {"foo"=>"bar", "baz"=>{"0"=>{"a"=>1} , "1"=>{"a"=>2}, "2"=>{"b"=>3}}, "daz"=>{"0"=>{"a"=>1} , "1"=>{"a"=>2}, "2"=>{"b"=>3}}}
53
+ ```
54
+ ```
55
+ <filter test**>
56
+ @type record_indexing
57
+ exclude_keys baz
58
+ </filter>
59
+
60
+ In:
61
+ {"foo" => "bar", "baz"=>[{"a"=>1}, {"a"=>2}, {"b"=>3}] , "daz" => [{"a"=>1}, {"a"=>2}, {"b"=>3}]}
62
+ Out:
63
+ {"foo"=>"bar", "baz"=>[{"a"=>1}, {"a"=>2}, {"b"=>3}], "2"=>{"b"=>3}}, "daz"=>{"0"=>{"a"=>1} , "1"=>{"a"=>2}, "2"=>{"b"=>3}}}
64
+ ```
42
65
 
43
66
  ## Installation
44
67
 
45
68
  ### RubyGems
46
69
 
47
70
  ```
48
- $ gem install fluent-plugin-array-spin
71
+ $ gem install fluent-plugin-record_indexing
49
72
  ```
50
73
 
51
74
  ### Bundler
@@ -64,8 +87,9 @@ $ bundle
64
87
 
65
88
  ## Configuration
66
89
 
67
- * **key_name** (string)
68
- * **key_prefix** (string)
90
+ * **key_names** (array) default: []
91
+ * **key_prefix** (string) default: nil
92
+ * **exclude_keys** (array) default: [] Use this parameter if you need to keep the value as is without indexing
69
93
  * **check_all_key** (bool) default: true
70
94
 
71
95
 
@@ -73,4 +97,4 @@ $ bundle
73
97
 
74
98
  * Copyright(c) 2017, Tema Novikov
75
99
  * License
76
- * Apache License, Version 2.0
100
+ * Apache License, Version 2.0
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "fluent-plugin-record_indexing"
4
- spec.version = "0.2.1"
4
+ spec.version = "0.2.2"
5
5
  spec.authors = ["imcotop"]
6
6
  spec.email = ["imcotop@icloud.com"]
7
7
 
8
8
  spec.summary = %{A fluentd filter plugin that will be used to Iterate over the object with its index and returns the value of the given object.}
9
9
  spec.description = spec.summary
10
10
  spec.homepage = "https://github.com/imcotop/fluent-plugin-record_indexing"
11
- spec.license = "Apache-2.0"
11
+ spec.license = "apache2"
12
12
 
13
13
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
14
14
  spec.executables = []
@@ -28,9 +28,13 @@ module Fluent
28
28
  if exclude_keys.include?(key)
29
29
  new_record[key] = value # Keep the value as is without indexing
30
30
  elsif value.is_a?(Array)
31
- new_record[key] = {}
32
- value.each_with_index do |item, index|
33
- new_record[key]["#{key_prefix}#{index}"] = item
31
+ if value.length == 1
32
+ new_record[key] = value.first
33
+ else
34
+ new_record[key] = {}
35
+ value.each_with_index do |item, index|
36
+ new_record[key]["#{key_prefix}#{index}"] = item
37
+ end
34
38
  end
35
39
  elsif value.is_a?(Hash)
36
40
  new_record[key] = {}
@@ -58,3 +62,4 @@ module Fluent
58
62
  end
59
63
  end
60
64
  end
65
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-record_indexing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - imcotop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-10 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,7 +76,7 @@ files:
76
76
  - lib/fluent/plugin/filter_record_indexing.rb
77
77
  homepage: https://github.com/imcotop/fluent-plugin-record_indexing
78
78
  licenses:
79
- - Apache-2.0
79
+ - apache2
80
80
  metadata: {}
81
81
  post_install_message:
82
82
  rdoc_options: []
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.2.5
96
+ rubygems_version: 3.0.3.1
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: A fluentd filter plugin that will be used to Iterate over the object with