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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34c2672e7b79ed2fade7c9eaa406023435edae44
4
- data.tar.gz: 987c6c08d7ec7b1e8729eba02ef16f0b9712f7b9
3
+ metadata.gz: 5887c99f4cb8a3b3784d585068e4a05ff4f1f5dd
4
+ data.tar.gz: 24d1d040e6e7fb12e5494a7a10cc7882cab800f1
5
5
  SHA512:
6
- metadata.gz: d12a48998e71d7228a178a29c785fdb9ef011cf438a586c2f65a09769af7f1f9a4dadc7fade39fafccc568e3acfce8b79fc9213712b945877d16779fff64302e
7
- data.tar.gz: 37746e2b3f644f4aa3e7e533f7e44f1591754ecdd8100fde9db8249a90fbfd633ff51902ecbed02efff533e6a76d12ec6dd993a3aa93e279bc875fa0945ab80e
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
- @next_refresh = Time.now + @refresh_interval
76
- lock_for_write { load_file }
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 network block list
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 network list is invalid, please check the separator character or permissions for the file."
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
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-contains'
4
- s.version = '1.0.0'
4
+ s.version = '1.0.1'
5
5
  s.platform = 'java'
6
6
  s.licenses = ['Apache License (2.0)']
7
7
  s.summary = "filter to check if value is contains"
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.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-03 00:00:00.000000000 Z
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