logstash-filter-grok 3.2.4 → 3.3.0
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/CHANGELOG.md +4 -0
- data/lib/logstash/filters/grok.rb +4 -3
- data/lib/logstash/filters/grok/timeout_enforcer.rb +2 -1
- data/logstash-filter-grok.gemspec +1 -1
- data/spec/filters/grok_spec.rb +17 -4
- 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: c5390fc2b96b4cd54b12e4553bcdd1371595a5e9
|
4
|
+
data.tar.gz: 7fe06830c1466f85e6df82f50ca8fb6947be2ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f747a46733715b5c8872a04c9b0b778707fbd2b76eded7c4036f7516a813dca10139c55eb81b94ce0b1c2f3023aed2d02e079d976c3f61783f45d83e7a106c2
|
7
|
+
data.tar.gz: a73926c240474e52832f18215e02ae92170b2e5e97642f8c148be891dceacaf39bf7345cd7e347c63b985c219be56030e10993c572ae6bca9b8d5fa37ec9d1ce
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 3.3.0
|
2
|
+
- Allow timeout enforcer to be disabled by setting timeout_millis to nil
|
3
|
+
- Change default timeout_millis to 30s
|
4
|
+
|
1
5
|
## 3.2.4
|
2
6
|
- Fix mutex interruption bug that could crash logstash. See: https://github.com/logstash-plugins/logstash-filter-grok/issues/97
|
3
7
|
|
@@ -199,7 +199,8 @@
|
|
199
199
|
# This applies per pattern if multiple patterns are applied
|
200
200
|
# This will never timeout early, but may take a little longer to timeout.
|
201
201
|
# Actual timeout is approximate based on a 250ms quantization.
|
202
|
-
|
202
|
+
# Set to 0 to disable timeouts
|
203
|
+
config :timeout_millis, :validate => :number, :default => 30000
|
203
204
|
|
204
205
|
# Tag to apply if a grok regexp times out.
|
205
206
|
config :tag_on_timeout, :validate => :string, :default => '_groktimeout'
|
@@ -238,7 +239,7 @@
|
|
238
239
|
@handlers = {}
|
239
240
|
|
240
241
|
@timeout_enforcer = TimeoutEnforcer.new(@logger, @timeout_millis * 1000000)
|
241
|
-
@timeout_enforcer.start!
|
242
|
+
@timeout_enforcer.start! unless @timeout_millis == 0
|
242
243
|
end
|
243
244
|
|
244
245
|
public
|
@@ -300,7 +301,7 @@
|
|
300
301
|
end
|
301
302
|
|
302
303
|
@logger.debug? and @logger.debug("Event now: ", :event => event)
|
303
|
-
rescue ::LogStash::Filters::Grok::TimeoutException => e
|
304
|
+
rescue ::LogStash::Filters::Grok::TimeoutException => e
|
304
305
|
@logger.warn(e.message)
|
305
306
|
metric.increment(:timeouts)
|
306
307
|
event.tag(@tag_on_timeout)
|
@@ -5,7 +5,7 @@ class LogStash::Filters::Grok::TimeoutEnforcer
|
|
5
5
|
|
6
6
|
def initialize(logger, timeout_nanos)
|
7
7
|
@logger = logger
|
8
|
-
@running =
|
8
|
+
@running = false
|
9
9
|
@timeout_nanos = timeout_nanos
|
10
10
|
|
11
11
|
# Stores running matches with their start time, this is used to cancel long running matches
|
@@ -32,6 +32,7 @@ class LogStash::Filters::Grok::TimeoutEnforcer
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def start!
|
35
|
+
@running = true
|
35
36
|
@timer_thread = Thread.new do
|
36
37
|
while @running
|
37
38
|
begin
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-grok'
|
4
|
-
s.version = '3.
|
4
|
+
s.version = '3.3.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Parse arbitrary text and structure it."
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
data/spec/filters/grok_spec.rb
CHANGED
@@ -409,9 +409,9 @@ describe LogStash::Filters::Grok do
|
|
409
409
|
|
410
410
|
describe "timeout on failure" do
|
411
411
|
config <<-CONFIG
|
412
|
-
filter {
|
412
|
+
filter {
|
413
413
|
grok {
|
414
|
-
match => {
|
414
|
+
match => {
|
415
415
|
message => "(.*a){30}"
|
416
416
|
}
|
417
417
|
timeout_millis => 100
|
@@ -821,15 +821,28 @@ describe LogStash::Filters::Grok do
|
|
821
821
|
end
|
822
822
|
end
|
823
823
|
|
824
|
-
describe "closing" do
|
824
|
+
describe "opening/closing" do
|
825
|
+
let(:config) { {"match" => {"message" => "A"}} }
|
825
826
|
subject(:plugin) do
|
826
|
-
::LogStash::Filters::Grok.new(
|
827
|
+
::LogStash::Filters::Grok.new(config)
|
827
828
|
end
|
828
829
|
|
829
830
|
before do
|
830
831
|
plugin.register
|
831
832
|
end
|
832
833
|
|
834
|
+
it "should start the timeout enforcer" do
|
835
|
+
expect(plugin.timeout_enforcer.running).to be true
|
836
|
+
end
|
837
|
+
|
838
|
+
context "with the timeout enforcer disabled" do
|
839
|
+
let(:config) { super.merge("timeout_millis" => 0) }
|
840
|
+
|
841
|
+
it "should not start the timeout enforcer" do
|
842
|
+
expect(plugin.timeout_enforcer.running).to be false
|
843
|
+
end
|
844
|
+
end
|
845
|
+
|
833
846
|
it "should close cleanly" do
|
834
847
|
expect { plugin.do_close }.not_to raise_error
|
835
848
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-grok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|