fluent-plugin-record-modifier 2.0.0 → 2.1.1
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.
- checksums.yaml +5 -5
- data/.github/workflows/linux.yml +26 -0
- data/ChangeLog +13 -0
- data/README.md +2 -2
- data/VERSION +1 -1
- data/fluent-plugin-record-modifier.gemspec +1 -1
- data/lib/fluent/plugin/filter_record_modifier.rb +3 -2
- data/lib/fluent/plugin/out_record_modifier.rb +7 -2
- data/test/test_filter_record_modifier.rb +11 -8
- data/test/test_out_record_modifier.rb +4 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5223ce121e04b41b661a2d575a7067f69295ea5d665656cb37a23acbd71d3624
|
|
4
|
+
data.tar.gz: 00e6c78cf07e354ab0a0d77d42a5bc00f782a1bcb9ca56899440ac75dbd6f4b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79597158486f6da9646479758d981afc494da860653006d93428abf9d5c211008f60339ca39d238a04b77f2aadd38f459f70b4dccb46c23618614cbc75795894
|
|
7
|
+
data.tar.gz: 8912416c324b79f0d4e4e6d29f8625105e1c983492e509a56484a81d5cb0c72b6270a915f087b4946d5d522b1817133a99341b9a91c241de01c4f7c501f3310b
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: linux
|
|
2
|
+
on:
|
|
3
|
+
- push
|
|
4
|
+
- pull_request
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ${{ matrix.os }}
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
ruby: ['2.6', '2.7', '3.0', '3.1']
|
|
12
|
+
os:
|
|
13
|
+
- ubuntu-latest
|
|
14
|
+
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
|
20
|
+
- name: unit testing
|
|
21
|
+
env:
|
|
22
|
+
CI: true
|
|
23
|
+
run: |
|
|
24
|
+
gem install bundler rake
|
|
25
|
+
bundle install --jobs 4 --retry 3
|
|
26
|
+
bundle exec rake test
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
Release 2.1.1 - 2022/08/25
|
|
2
|
+
|
|
3
|
+
* Improve whitelist_keys performance
|
|
4
|
+
* Fix documentation for named capture references
|
|
5
|
+
|
|
6
|
+
Release 2.1.0 - 2019/12/18
|
|
7
|
+
|
|
8
|
+
* Add <record> keys to whitelist_keys
|
|
9
|
+
|
|
10
|
+
Release 2.0.1 - 2019/02/06
|
|
11
|
+
|
|
12
|
+
* Update output plugin to support multi process environment
|
|
13
|
+
|
|
1
14
|
Release 2.0.0 - 2019/01/23
|
|
2
15
|
|
|
3
16
|
* Update output plugin to follow filter plugin
|
data/README.md
CHANGED
|
@@ -164,7 +164,7 @@ If you want to replace specific value for keys you can use `replace` section.
|
|
|
164
164
|
# your regexp
|
|
165
165
|
expression /^(?<start>.+).{2}(?<end>.+)$/
|
|
166
166
|
# replace string
|
|
167
|
-
replace
|
|
167
|
+
replace \k<start>ors\k<end>
|
|
168
168
|
</replace>
|
|
169
169
|
# replace key key2
|
|
170
170
|
<replace>
|
|
@@ -173,7 +173,7 @@ If you want to replace specific value for keys you can use `replace` section.
|
|
|
173
173
|
# your regexp
|
|
174
174
|
expression /^(.{1}).{2}(.{1})$/
|
|
175
175
|
# replace string
|
|
176
|
-
replace
|
|
176
|
+
replace \1ors\2
|
|
177
177
|
</replace>
|
|
178
178
|
</filter>
|
|
179
179
|
```
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.1.1
|
|
@@ -83,6 +83,7 @@ DESC
|
|
|
83
83
|
@remove_keys = @remove_keys.split(',').map(&:strip)
|
|
84
84
|
elsif @whitelist_keys
|
|
85
85
|
@whitelist_keys = @whitelist_keys.split(',').map(&:strip)
|
|
86
|
+
@whitelist_keys.concat(@map.keys).uniq!
|
|
86
87
|
end
|
|
87
88
|
|
|
88
89
|
# Collect DynamicExpander related garbage instructions
|
|
@@ -102,8 +103,8 @@ DESC
|
|
|
102
103
|
}
|
|
103
104
|
elsif @whitelist_keys
|
|
104
105
|
modified = {}
|
|
105
|
-
|
|
106
|
-
modified[
|
|
106
|
+
@whitelist_keys.each do |key|
|
|
107
|
+
modified[key] = record[key] if record.has_key?(key)
|
|
107
108
|
end
|
|
108
109
|
record = modified
|
|
109
110
|
end
|
|
@@ -88,6 +88,7 @@ DESC
|
|
|
88
88
|
@remove_keys = @remove_keys.split(',').map(&:strip)
|
|
89
89
|
elsif @whitelist_keys
|
|
90
90
|
@whitelist_keys = @whitelist_keys.split(',').map(&:strip)
|
|
91
|
+
@whitelist_keys.concat(@map.keys).uniq!
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
@has_tag_parts = true if @tag.include?('tag_parts')
|
|
@@ -97,6 +98,10 @@ DESC
|
|
|
97
98
|
GC.start
|
|
98
99
|
end
|
|
99
100
|
|
|
101
|
+
def multi_workers_ready?
|
|
102
|
+
true
|
|
103
|
+
end
|
|
104
|
+
|
|
100
105
|
def process(tag, es)
|
|
101
106
|
tag_parts = @has_tag_parts ? tag.split('.') : nil
|
|
102
107
|
if @tag_ex.param_value.nil?
|
|
@@ -133,8 +138,8 @@ DESC
|
|
|
133
138
|
}
|
|
134
139
|
elsif @whitelist_keys
|
|
135
140
|
modified = {}
|
|
136
|
-
|
|
137
|
-
modified[
|
|
141
|
+
@whitelist_keys.each do |key|
|
|
142
|
+
modified[key] = record[key] if record.has_key?(key)
|
|
138
143
|
end
|
|
139
144
|
record = modified
|
|
140
145
|
end
|
|
@@ -116,6 +116,9 @@ class RecordModifierFilterTest < Test::Unit::TestCase
|
|
|
116
116
|
|
|
117
117
|
def test_remove_non_whitelist_keys
|
|
118
118
|
d = create_driver %[
|
|
119
|
+
<record>
|
|
120
|
+
foo bar
|
|
121
|
+
</record>
|
|
119
122
|
whitelist_keys k1, k2, k3
|
|
120
123
|
]
|
|
121
124
|
|
|
@@ -123,7 +126,7 @@ class RecordModifierFilterTest < Test::Unit::TestCase
|
|
|
123
126
|
d.feed("k1" => 'v', "k2" => 'v', "k4" => 'v', "k5" => 'v')
|
|
124
127
|
end
|
|
125
128
|
|
|
126
|
-
assert_equal [{"k1" => 'v', "k2" => 'v'}], d.filtered.map(&:last)
|
|
129
|
+
assert_equal [{"k1" => 'v', "k2" => 'v', 'foo' => 'bar'}], d.filtered.map(&:last)
|
|
127
130
|
end
|
|
128
131
|
|
|
129
132
|
def test_prepare_values
|
|
@@ -142,18 +145,18 @@ class RecordModifierFilterTest < Test::Unit::TestCase
|
|
|
142
145
|
end
|
|
143
146
|
|
|
144
147
|
def test_replace_values
|
|
145
|
-
d = create_driver
|
|
148
|
+
d = create_driver <<'CONFIG'
|
|
146
149
|
<replace>
|
|
147
150
|
key k1
|
|
148
151
|
expression /^(?<start>.+).{2}(?<end>.+)$/
|
|
149
|
-
replace
|
|
152
|
+
replace \k<start>ors\k<end>
|
|
150
153
|
</replace>
|
|
151
154
|
<replace>
|
|
152
155
|
key k2
|
|
153
156
|
expression /^(.{1}).{2}(.{1})$/
|
|
154
|
-
replace
|
|
157
|
+
replace \1ors\2
|
|
155
158
|
</replace>
|
|
156
|
-
|
|
159
|
+
CONFIG
|
|
157
160
|
|
|
158
161
|
d.run(default_tag: @tag) do
|
|
159
162
|
d.feed("k1" => 'hoge', "k2" => 'hoge', "k3" => 'bar')
|
|
@@ -163,13 +166,13 @@ class RecordModifierFilterTest < Test::Unit::TestCase
|
|
|
163
166
|
end
|
|
164
167
|
|
|
165
168
|
def test_does_not_replace
|
|
166
|
-
d = create_driver
|
|
169
|
+
d = create_driver <<'CONFIG'
|
|
167
170
|
<replace>
|
|
168
171
|
key k1
|
|
169
172
|
expression /^(?<start>.+).{2}(?<end>.+)$/
|
|
170
|
-
replace
|
|
173
|
+
replace \k<start>ors\k<end>
|
|
171
174
|
</replace>
|
|
172
|
-
|
|
175
|
+
CONFIG
|
|
173
176
|
|
|
174
177
|
d.run(default_tag: @tag) do
|
|
175
178
|
d.feed("k1" => 'hog')
|
|
@@ -127,6 +127,9 @@ class RecordModifierOutputTest < Test::Unit::TestCase
|
|
|
127
127
|
def test_remove_non_whitelist_keys
|
|
128
128
|
d = create_driver %[
|
|
129
129
|
tag foo.filtered
|
|
130
|
+
<record>
|
|
131
|
+
foo bar
|
|
132
|
+
</record>
|
|
130
133
|
whitelist_keys k1, k2, k3
|
|
131
134
|
]
|
|
132
135
|
|
|
@@ -134,6 +137,6 @@ class RecordModifierOutputTest < Test::Unit::TestCase
|
|
|
134
137
|
d.feed({"k1" => 'v', "k2" => 'v', "k4" => 'v', "k5" => 'v'})
|
|
135
138
|
end
|
|
136
139
|
|
|
137
|
-
assert_equal [{"k1" => 'v', "k2" => 'v'}], d.events.map { |e| e.last }
|
|
140
|
+
assert_equal [{"k1" => 'v', "k2" => 'v', 'foo' => 'bar'}], d.events.map { |e| e.last }
|
|
138
141
|
end
|
|
139
142
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-record-modifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro Nakagawa
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|
|
@@ -50,20 +50,21 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 3.
|
|
53
|
+
version: '3.3'
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 3.
|
|
60
|
+
version: '3.3'
|
|
61
61
|
description: Filter plugin for modifying event record
|
|
62
62
|
email: repeatedly@gmail.com
|
|
63
63
|
executables: []
|
|
64
64
|
extensions: []
|
|
65
65
|
extra_rdoc_files: []
|
|
66
66
|
files:
|
|
67
|
+
- ".github/workflows/linux.yml"
|
|
67
68
|
- ".travis.yml"
|
|
68
69
|
- ChangeLog
|
|
69
70
|
- Gemfile
|
|
@@ -79,7 +80,7 @@ homepage: https://github.com/repeatedly/fluent-plugin-record-modifier
|
|
|
79
80
|
licenses:
|
|
80
81
|
- MIT
|
|
81
82
|
metadata: {}
|
|
82
|
-
post_install_message:
|
|
83
|
+
post_install_message:
|
|
83
84
|
rdoc_options: []
|
|
84
85
|
require_paths:
|
|
85
86
|
- lib
|
|
@@ -94,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
95
|
- !ruby/object:Gem::Version
|
|
95
96
|
version: '0'
|
|
96
97
|
requirements: []
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
signing_key:
|
|
98
|
+
rubygems_version: 3.3.7
|
|
99
|
+
signing_key:
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: Filter plugin for modifying event record
|
|
102
102
|
test_files:
|