logstash-filter-hash_select 0.1.0 → 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: cd2d35c778622e8c426d1d682dff1ca5490522f2eedf0b05655870da47fd0610
4
- data.tar.gz: 211b24a0943614df62afe4c6384336f2cd1795b412b2febcc1b84dad22bb8be9
3
+ metadata.gz: be7d2e025b4360591b5da998367530c00548077aa57bed363ac925c9dfb80371
4
+ data.tar.gz: a2b7e07c6c5cbb0f67ced22c3650b7bc24546a0f8448e99aca27a5d7569f21bb
5
5
  SHA512:
6
- metadata.gz: ea6e7b89fa5da876fb733c47e50ad92bdb8cadb85f705addd6766f66afc5fe2c6c367078b703580b8e6f9760745698c9729a11b82dde7c6af9140c915368f733
7
- data.tar.gz: d56c5655b07df5c26f8f8f3eac79466b35cd2101a2176f24082305f15f4e615bf524ed1c899c8a0dc89bda31e11010be8a3f357d3590dd82a532ec515abab7e8
6
+ metadata.gz: '0081bf485da8330d5ea5bea04d5fca50ffc065489f54e11a71661b2bf41041da1adc00eefa8f1663f2d3decda58664ea86cc4f46c26ee26a2a03c4c9d1b1cf32'
7
+ data.tar.gz: e5f4969df9f6e220999874e9dd452f1c0e9e5b41853d0c13e7f47eb578b559792a78f2adb7e0578dcbd24aaf4d22ca20f366def8aaee7a85921808e1accc8eb9
data/CHANGELOG.md CHANGED
@@ -1,2 +1,8 @@
1
+ ## 0.1.2
2
+ - Logic optimization
3
+
4
+ ## 0.1.1
5
+ - Fix homepage for gemspec
6
+
1
7
  ## 0.1.0
2
8
  - First release
@@ -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,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-hash_select'
3
- s.version = '0.1.0'
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'
7
- s.homepage = 'https://github.com/r16turbo/logstash-output-influxdb2'
7
+ s.homepage = 'https://github.com/r16turbo/logstash-filter-hash_select'
8
8
  s.authors = ['Issey Yamakoshi']
9
9
  s.email = 'r16turbo@gmail.com'
10
10
  s.require_paths = ['lib']
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.0
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-22 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
@@ -54,7 +54,7 @@ files:
54
54
  - lib/logstash/filters/hash_select.rb
55
55
  - logstash-filter-hash_select.gemspec
56
56
  - spec/filters/hash_select_spec.rb
57
- homepage: https://github.com/r16turbo/logstash-output-influxdb2
57
+ homepage: https://github.com/r16turbo/logstash-filter-hash_select
58
58
  licenses:
59
59
  - Apache-2.0
60
60
  metadata: