logstash-filter-transaction_time 1.0.6 → 1.0.7

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: 42a93843867d9601c8d72c1f3d917eda47a3f2b8
4
- data.tar.gz: 2676edf5d3fdc07dc0289013b590a95f35a16dcd
3
+ metadata.gz: 35cbfca75598548db9d7214ac0a9bab57e01764f
4
+ data.tar.gz: '08f835e5afbe6e2660939747f622904758ef19c7'
5
5
  SHA512:
6
- metadata.gz: 440e19f5bf51f6a9a3111139c6dad52c3b84b535aa3f14e43352c5eb7d4f62388a8a2c6c1ad6c71d27b9bbc803e9cdf4d71ea3bc376b716552099815f45c4a5a
7
- data.tar.gz: 1e00fb737f7a7a69139df1718acd32784dd75cad2ba759bf04d5a0cdfc5525aa29dcdc30659de59d370c9ad7fc22bedbd152ac73aa7f68fcb29868ea7742e816
6
+ metadata.gz: 6ac5b9ec7a6b1bab0e6115e7b3ba38e2cb8ab7161e704bc6b64e768c17cb1ae22956f4ff0f899812aa55fc537ec70035172494fed7a0fb91d24e9aca4b93c99d
7
+ data.tar.gz: e4680eac48d285741b09183fa5f855b51b5d3132843b5a94a6b99caf4cf07106abc98aa3b4b22a266c7541b8066366d368439a71a9d0e721cdf59563b52e404a
@@ -346,7 +346,8 @@ class LogStash::Filters::TransactionTime::Transaction
346
346
  @diff = calculateDiff()
347
347
  end
348
348
 
349
- #Gets the first (based on timestamp) event
349
+ #Gets the oldest (based on timestamp) event
350
+ #Or the second if they are equal
350
351
  def getOldestEvent()
351
352
  if invalidTransaction()
352
353
  return nil
@@ -363,12 +364,13 @@ class LogStash::Filters::TransactionTime::Transaction
363
364
  return [@firstTimestamp,@secondTimestamp].min
364
365
  end
365
366
 
366
- #Gets the last (based on timestamp) event
367
+ #Gets the newest (based on timestamp) event
368
+ #Or the first if they are equal
367
369
  def getNewestEvent()
368
370
  if invalidTransaction()
369
371
  return nil
370
372
  end
371
- if(@firstTimestamp > @secondTimestamp)
373
+ if(@firstTimestamp >= @secondTimestamp)
372
374
  return @firstEvent
373
375
  else
374
376
  return @lastEvent
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-transaction_time'
3
- s.version = '1.0.6'
3
+ s.version = '1.0.7'
4
4
  s.licenses = ['Apache-2.0','Apache License (2.0)']
5
5
  s.summary = 'Writes the time difference between two events in a transaction to a new event'
6
6
  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. Source-code and documentation available at github: https://github.com/AddinITAB/logstash-filter-transaction_time'
@@ -349,6 +349,38 @@ describe LogStash::Filters::TransactionTime do
349
349
  end
350
350
  end
351
351
  end
352
+ describe "with 'newest' when timestamps are equal" do
353
+ it "attaches info from the first event in transaction" do
354
+ config = {"attach_event" => 'newest'}
355
+ @config.merge!(config)
356
+
357
+ @filter = LogStash::Filters::TransactionTime.new(@config)
358
+ @filter.register
359
+
360
+ @filter.filter(event("message" => "first", UID_FIELD => uid, "@timestamp" => "2019-01-23T09:46:22.000+0100"))
361
+ @filter.filter(event("message" => "second", UID_FIELD => uid, "@timestamp" => "2019-01-23T09:46:22.000+0100")) do | new_event |
362
+ insist { new_event } != nil
363
+ insist { new_event.get("tags").include?("TransactionTime") }
364
+ insist { new_event.get("message") } == "first"
365
+ end
366
+ end
367
+ end
368
+ describe "with 'oldest' when timestamps are equal" do
369
+ it "attaches info from the second event in transaction" do
370
+ config = {"attach_event" => 'oldest'}
371
+ @config.merge!(config)
372
+
373
+ @filter = LogStash::Filters::TransactionTime.new(@config)
374
+ @filter.register
375
+
376
+ @filter.filter(event("message" => "first", UID_FIELD => uid, "@timestamp" => "2019-01-23T09:46:22.000+0100"))
377
+ @filter.filter(event("message" => "second", UID_FIELD => uid, "@timestamp" => "2019-01-23T09:46:22.000+0100")) do | new_event |
378
+ insist { new_event } != nil
379
+ insist { new_event.get("tags").include?("TransactionTime") }
380
+ insist { new_event.get("message") } == "second"
381
+ end
382
+ end
383
+ end
352
384
  end
353
385
  end
354
386
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-transaction_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Welleby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement