logstash-filter-hash_select 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 2e9c21d0ab52da9b40d4cf5787d725bf2ac334c12197c7eee5645ec74640e76f
4
- data.tar.gz: ce6a816ce643c3412646e3d43164e17ebe489b8e4bc52d33d1e829ea48f58a45
3
+ metadata.gz: be7d2e025b4360591b5da998367530c00548077aa57bed363ac925c9dfb80371
4
+ data.tar.gz: a2b7e07c6c5cbb0f67ced22c3650b7bc24546a0f8448e99aca27a5d7569f21bb
5
5
  SHA512:
6
- metadata.gz: 931818af0cf335b783a2d203c27634b3bfd24087a90fcd03f3eb5e5b5cf927eebccc6d6f7f691a20f1ddc62fae93122c2a214857f60e5d076cfa132606e807e7
7
- data.tar.gz: d33e99bc12283bb7964103d0b42968f09d209978ebe52b1727da7508e2684ef309dc05faeef25f20d03887c1a2d05372e49205d136fd9227c4d87fc12711eb58
6
+ metadata.gz: '0081bf485da8330d5ea5bea04d5fca50ffc065489f54e11a71661b2bf41041da1adc00eefa8f1663f2d3decda58664ea86cc4f46c26ee26a2a03c4c9d1b1cf32'
7
+ data.tar.gz: e5f4969df9f6e220999874e9dd452f1c0e9e5b41853d0c13e7f47eb578b559792a78f2adb7e0578dcbd24aaf4d22ca20f366def8aaee7a85921808e1accc8eb9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.2
2
+ - Logic optimization
3
+
1
4
  ## 0.1.1
2
5
  - Fix homepage for gemspec
3
6
 
@@ -20,14 +20,15 @@ class LogStash::Filters::Hash_select < LogStash::Filters::Base
20
20
  public
21
21
  def filter(event)
22
22
  field = event.get(@hash_field)
23
- if field.is_a?(Hash)
24
- before = field.size
25
- unless @include_keys.empty?
26
- field = field.select { |k,v| @include_keys.include?(k) }
27
- end
28
- unless @exclude_keys.empty?
29
- field = field.select { |k,v| ! @exclude_keys.include?(k) }
30
- end
23
+ if field.is_a?(Hash) && (before = field.size).positive?
24
+ field =
25
+ if @include_keys.empty?
26
+ field.reject { |k, _| @exclude_keys.include?(k) } unless @exclude_keys.empty?
27
+ elsif @exclude_keys.empty?
28
+ field.select { |k, _| @include_keys.include?(k) }
29
+ else
30
+ field.select { |k, _| @include_keys.include?(k) && !@exclude_keys.include?(k) }
31
+ end
31
32
  event.set(@hash_field, field) if field.size < before
32
33
  end
33
34
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-hash_select'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Select entries from a specific hash field'
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'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-hash_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issey Yamakoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-26 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api