logstash-filter-grok 3.2.4 → 3.3.0

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: b034532a205ad23ce96a26ec94a38168714f89b5
4
- data.tar.gz: 864f130d2549eeafff4c1f4b5fdd8ab6e2646bab
3
+ metadata.gz: c5390fc2b96b4cd54b12e4553bcdd1371595a5e9
4
+ data.tar.gz: 7fe06830c1466f85e6df82f50ca8fb6947be2ac9
5
5
  SHA512:
6
- metadata.gz: edd8cfade5fef7b64a5199c500574db16848de04fade4cabbfae9c58f07667cc94c23a41ed117f383c683baf44ec06b1b6aeb1048349ca620d147f0139d1d2e7
7
- data.tar.gz: 1753891e587a891e65cb57b540814d619192a9bf5ef1d71fedb703207e9d5004fd1da26f3cd0725430620555e5bad05b19c2d3b43ef0e79ab937298e71e5931f
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
- config :timeout_millis, :validate => :number, :default => 2000
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 = true
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.2.4'
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"
@@ -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("match" => {"message" => "A"})
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.2.4
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-01 00:00:00.000000000 Z
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