logstash-filter-contains 1.0.0-java → 1.0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/filters/contains.rb +19 -5
- data/logstash-filter-contains.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5887c99f4cb8a3b3784d585068e4a05ff4f1f5dd
|
4
|
+
data.tar.gz: 24d1d040e6e7fb12e5494a7a10cc7882cab800f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a93b060bdb5efbadc1c72473c65f142a3db41928b7260d80438d72dfeb6e1928fbbe4524ff037688a411a265a5b1ab7991bf0817bd0381e458b9a8ba03efe130
|
7
|
+
data.tar.gz: 410a17c9310f6555a6e8bf18cba3ed5c83a01713303f662090b1a1c246e100be175fe96084d4673a1704102cfec74cac3476887394340b13186d65f137294935
|
@@ -72,8 +72,11 @@ class LogStash::Filters::CONTAINS < LogStash::Filters::Base
|
|
72
72
|
end
|
73
73
|
|
74
74
|
if @value_path
|
75
|
-
|
76
|
-
|
75
|
+
lock_for_write {
|
76
|
+
load_file
|
77
|
+
@last_mtime = File.mtime(@value_path)
|
78
|
+
@next_refresh = Time.now() + @refresh_interval
|
79
|
+
}
|
77
80
|
end
|
78
81
|
end # def register
|
79
82
|
|
@@ -86,7 +89,7 @@ class LogStash::Filters::CONTAINS < LogStash::Filters::Base
|
|
86
89
|
end
|
87
90
|
end # def lock_for_write
|
88
91
|
|
89
|
-
def lock_for_read #ensuring only one thread updates the
|
92
|
+
def lock_for_read #ensuring only one thread updates the value block list
|
90
93
|
@read_lock.lock
|
91
94
|
begin
|
92
95
|
yield
|
@@ -96,11 +99,21 @@ class LogStash::Filters::CONTAINS < LogStash::Filters::Base
|
|
96
99
|
end #def lock_for_read
|
97
100
|
|
98
101
|
def needs_refresh?
|
99
|
-
@next_refresh < Time.now
|
102
|
+
if @next_refresh < Time.now
|
103
|
+
if @last_mtime != File.mtime(@value_path)
|
104
|
+
return true
|
105
|
+
else
|
106
|
+
@next_refresh = Time.now + @refresh_interval
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
else
|
110
|
+
return false
|
111
|
+
end
|
100
112
|
end # def needs_refresh
|
101
113
|
|
102
114
|
def load_file
|
103
115
|
begin
|
116
|
+
@logger.debug("load_file called")
|
104
117
|
temporary = File.open(@value_path, "r") {|file| file.read.split(@separator)}
|
105
118
|
if !temporary.empty? #ensuring the file was parsed correctly
|
106
119
|
@value_set = temporary.to_set
|
@@ -115,7 +128,7 @@ class LogStash::Filters::CONTAINS < LogStash::Filters::Base
|
|
115
128
|
"logstash.agent.configuration.invalid_plugin_register",
|
116
129
|
:plugin => "filter",
|
117
130
|
:type => "contains",
|
118
|
-
:error => "The file containing the
|
131
|
+
:error => "The file containing the value list is invalid, please check the separator character or permissions for the file."
|
119
132
|
)
|
120
133
|
end
|
121
134
|
end
|
@@ -139,6 +152,7 @@ class LogStash::Filters::CONTAINS < LogStash::Filters::Base
|
|
139
152
|
if needs_refresh?
|
140
153
|
load_file
|
141
154
|
@next_refresh = Time.now() + @refresh_interval
|
155
|
+
@last_mtime = File.mtime(@value_path)
|
142
156
|
end
|
143
157
|
end #end lock
|
144
158
|
end #end refresh from file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-contains
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- donghyeon kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|