fluent-plugin-filter-list 0.7.0 → 0.7.2
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 +4 -4
- data/.github/dependabot.yml +8 -0
- data/.rubocop.yml +6 -4
- data/.travis.yml +3 -3
- data/Gemfile +1 -1
- data/fluent-plugin-out_filter_list.gemspec +1 -0
- data/lib/fluent/plugin/out_filter_list.rb +3 -7
- data/lib/fluent/plugin/out_filter_list/version.rb +1 -1
- data/lib/matcher.rb +14 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d213a158b64257afde99c26284bf0215c1a5d208362f0f00012580852654244e
|
4
|
+
data.tar.gz: 37c5a0219f4bab0de18b6aac6c75d6d90f63bd60f5eddb5399bfb0522c563706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 776d9222ea8997eda4506348282ed67415296da63c4dcd16569f2a7db35863a5844b3e3869cff5d9dcd9a077d4738a9733e4cf3b3436bc7ec08a26b8d4d84503
|
7
|
+
data.tar.gz: b73678d3bd2ba2a415499256cf6b8b7ba1c8c0a88800745d6668aaea1ba049d59343ca2665063cb4a11c1d099ce9ce825fffc57465dde845ee62c34b39f3a49a
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
NewCops: enable
|
4
|
+
|
3
5
|
|
4
6
|
Naming/MethodParameterName:
|
5
7
|
Enabled: false
|
@@ -38,7 +40,7 @@ Metrics/PerceivedComplexity:
|
|
38
40
|
Style/GlobalVars:
|
39
41
|
Exclude:
|
40
42
|
- 'test/test_helper.rb'
|
41
|
-
|
43
|
+
Lint/MissingSuper:
|
42
44
|
Exclude:
|
43
45
|
- 'test/test_helper.rb'
|
44
46
|
Style/MissingRespondToMissing:
|
@@ -48,7 +50,7 @@ Style/TernaryParentheses:
|
|
48
50
|
Enabled: false
|
49
51
|
Style/BlockDelimiters:
|
50
52
|
AutoCorrect: false
|
51
|
-
Style/BracesAroundHashParameters:
|
52
|
-
Enabled: false
|
53
53
|
Layout/FirstHashElementIndentation:
|
54
54
|
EnforcedStyle: consistent
|
55
|
+
Style/RedundantSelfAssignment:
|
56
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Fluent::Plugin::FilterList::VERSION
|
9
9
|
spec.authors = ['Shun Yanaura']
|
10
10
|
spec.email = ['metroplexity@gmail.com']
|
11
|
+
spec.required_ruby_version = '>= 2.5.0'
|
11
12
|
|
12
13
|
spec.summary = 'A fluentd output plugin to filter keywords from messages'
|
13
14
|
spec.description = 'A fluentd output plugin to filter keywords from messages'
|
@@ -31,10 +31,6 @@ module Fluent
|
|
31
31
|
config_param :add_prefix, :string, default: nil
|
32
32
|
end
|
33
33
|
|
34
|
-
def initialize
|
35
|
-
super
|
36
|
-
end
|
37
|
-
|
38
34
|
def validate(retag)
|
39
35
|
return unless retag
|
40
36
|
raise Fluent::ConfigError, "missing tag and add_prefix" unless retag.tag || retag.add_prefix
|
@@ -42,9 +38,9 @@ module Fluent
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def configure_prefixes
|
45
|
-
@prefix_for_filtered_tag = @retag_for_filtered.add_prefix
|
46
|
-
@prefix_for_filtered_tag = @retag_for_filtered&.add_prefix ? @retag_for_filtered.add_prefix
|
47
|
-
@prefix = @retag&.add_prefix ? @retag.add_prefix
|
41
|
+
@prefix_for_filtered_tag = "#{@retag_for_filtered.add_prefix}." if @retag_for_filtered&.add_prefix
|
42
|
+
@prefix_for_filtered_tag = @retag_for_filtered&.add_prefix ? "#{@retag_for_filtered.add_prefix}." : ''
|
43
|
+
@prefix = @retag&.add_prefix ? "#{@retag.add_prefix}." : ''
|
48
44
|
end
|
49
45
|
|
50
46
|
def configure(conf)
|
data/lib/matcher.rb
CHANGED
@@ -13,16 +13,25 @@ module Matchers
|
|
13
13
|
def matches?(text)
|
14
14
|
node = @trie.root
|
15
15
|
text.to_s.chars.each do |char|
|
16
|
-
|
16
|
+
failure = node.failure
|
17
17
|
node = node.children[char]
|
18
|
-
|
18
|
+
|
19
|
+
return true unless node.nil? || node.output.nil?
|
20
|
+
return true unless failure.nil? || failure.output.nil?
|
21
|
+
|
22
|
+
# Follow failure if it exists in case pattern doesn't match
|
23
|
+
node = failure if node.nil?
|
19
24
|
end
|
20
|
-
|
25
|
+
|
26
|
+
return false if node.failure.nil?
|
27
|
+
|
28
|
+
!node.failure.output.nil?
|
21
29
|
end
|
22
30
|
end
|
23
31
|
|
24
32
|
class IPMatcher
|
25
33
|
attr_reader :trie
|
34
|
+
|
26
35
|
include IP
|
27
36
|
|
28
37
|
def initialize(patterns)
|
@@ -40,6 +49,7 @@ module Matchers
|
|
40
49
|
|
41
50
|
class Trie
|
42
51
|
attr_reader :root
|
52
|
+
|
43
53
|
def initialize(patterns)
|
44
54
|
@root = Node.new
|
45
55
|
@root.children.default = @root
|
@@ -59,7 +69,7 @@ module Matchers
|
|
59
69
|
|
60
70
|
def new_queue
|
61
71
|
q = Queue.new
|
62
|
-
@root.children.
|
72
|
+
@root.children.each_value do |child|
|
63
73
|
q.push(child)
|
64
74
|
child.failure = @root # set root on root's children's failure
|
65
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-filter-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shun Yanaura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,6 +95,7 @@ executables:
|
|
95
95
|
extensions: []
|
96
96
|
extra_rdoc_files: []
|
97
97
|
files:
|
98
|
+
- ".github/dependabot.yml"
|
98
99
|
- ".gitignore"
|
99
100
|
- ".rubocop.yml"
|
100
101
|
- ".travis.yml"
|
@@ -116,7 +117,7 @@ homepage: https://github.com/yanana/fluent-plugin-filter-list
|
|
116
117
|
licenses:
|
117
118
|
- MIT
|
118
119
|
metadata: {}
|
119
|
-
post_install_message:
|
120
|
+
post_install_message:
|
120
121
|
rdoc_options: []
|
121
122
|
require_paths:
|
122
123
|
- lib
|
@@ -124,15 +125,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
125
|
requirements:
|
125
126
|
- - ">="
|
126
127
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
128
|
+
version: 2.5.0
|
128
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
130
|
requirements:
|
130
131
|
- - ">="
|
131
132
|
- !ruby/object:Gem::Version
|
132
133
|
version: '0'
|
133
134
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
135
|
-
signing_key:
|
135
|
+
rubygems_version: 3.1.4
|
136
|
+
signing_key:
|
136
137
|
specification_version: 4
|
137
138
|
summary: A fluentd output plugin to filter keywords from messages
|
138
139
|
test_files: []
|