fluent-plugin-record_indexing_test 0.2.1 → 0.2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-record_indexing.gemspec +1 -1
- data/lib/fluent/plugin/filter_record_indexing.rb +18 -9
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7796f884ed595263aec7d09a800478fc8ec6e4940995f62b768ecb463bd557
|
4
|
+
data.tar.gz: f9a2ef6751760bd6b0853412c55111874b133c71e33e5a5c2070b2e0973929ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b16b2a62b07104ea552adb931f74cb6da8800cb517e55b78568fc532641224f7d839d838233ba33169073c7771023ae7b77f3b27275fafb0144851e63710db3
|
7
|
+
data.tar.gz: 9775ad98ca05b1d223900d73e67b2ae903f1008f458f21095f9a55b9f6f0d9b26ea7a311a33f2447f6c7dfc7dd9ed9791795dfb8a29999ff916d1b7dbd255f80
|
@@ -8,13 +8,12 @@ module Fluent
|
|
8
8
|
config_param :key_names, :array, default: []
|
9
9
|
config_param :key_prefix, :string, default: nil
|
10
10
|
config_param :check_all_key, :bool, default: true
|
11
|
+
config_param :ignore_length, :bool, default: true
|
11
12
|
config_param :exclude_keys, :array, default: []
|
12
13
|
|
13
14
|
def filter(tag, time, record)
|
14
|
-
if check_all_key
|
15
|
-
|
16
|
-
raise ArgumentError, "key_names parameter is required if check_all_key set false"
|
17
|
-
end
|
15
|
+
if !@check_all_key && key_names.empty?
|
16
|
+
raise ArgumentError, "key_names parameter is required if check_all_key set false"
|
18
17
|
end
|
19
18
|
new_record = {}
|
20
19
|
each_with_index(record, new_record)
|
@@ -23,17 +22,28 @@ module Fluent
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def each_with_index(record, new_record)
|
25
|
+
seen_keys = {} # To keep track of duplicate names
|
26
26
|
record.each do |key, value|
|
27
|
-
if check_all_key || key_names.include?(key)
|
28
|
-
if exclude_keys.include?(key)
|
27
|
+
if @check_all_key || @key_names.include?(key)
|
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
|
-
if value.length == 1
|
31
|
+
if !@ignore_length && value.length == 1
|
32
32
|
new_record[key] = value.first
|
33
33
|
else
|
34
34
|
new_record[key] = {}
|
35
35
|
value.each_with_index do |item, index|
|
36
|
-
|
36
|
+
if item.is_a?(Hash) && item.key?("name") && item.key?("value")
|
37
|
+
item_name = item["name"]
|
38
|
+
if seen_keys[item_name]
|
39
|
+
new_record[key]["#{@key_prefix}#{index}"] = item
|
40
|
+
else
|
41
|
+
new_record[key][item_name] = item["value"]
|
42
|
+
seen_keys[item_name] = true
|
43
|
+
end
|
44
|
+
else
|
45
|
+
new_record[key]["#{@key_prefix}#{index}"] = item
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
elsif value.is_a?(Hash)
|
@@ -62,4 +72,3 @@ module Fluent
|
|
62
72
|
end
|
63
73
|
end
|
64
74
|
end
|
65
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-record_indexing_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- imcotop
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,7 +78,7 @@ homepage: https://github.com/imcotop/fluent-plugin-record_indexing
|
|
78
78
|
licenses:
|
79
79
|
- apache2
|
80
80
|
metadata: {}
|
81
|
-
post_install_message:
|
81
|
+
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|
84
84
|
- lib
|
@@ -93,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
97
|
-
signing_key:
|
96
|
+
rubygems_version: 3.5.7
|
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
|
100
100
|
its index and returns the value of the given object.
|