logstash-filter-ipam 0.1.0 → 0.1.1

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: bb0a3a5b9dad21a618c83351e89b1004e4b421804be11b0577986e27d81b635c
4
- data.tar.gz: 11407797b2a23a988f902b6d168d4babfd6ad01ab4daa7dbd6e8f55b014f3f5f
3
+ metadata.gz: 5f160ac54f8bc792c5c8e532de086002091d27cc571784e3d9139001d5c9530d
4
+ data.tar.gz: 3ea8071243425f5e7426079c86f1f5ceeed4bc233d52abc1f7c98031a554d965
5
5
  SHA512:
6
- metadata.gz: 0f6ef4584f286cc1ea61c69583b0854d8336e7f805c9c7f8be8c0e7f979bb5477d1c8853739e566c2a5634548e24289817eaa6d45494a3191fea550404221c5a
7
- data.tar.gz: 8d3529505f324526cee373cf6979fb311978052c8c1b77f36fe3a9a8d373d333c5d79bb79c02e2318f09d9571a53436e6e5d199dbda4d4976e73761b16cdf072
6
+ metadata.gz: fe0ba9b1b3b94b31e18ab3414b8531bdde0d50ca4b3aaeb5e27b11f21e0c4fb38308a7e052f69d09ae318c5af4b061f494890e120ba7598630c33e52c1c7fe62
7
+ data.tar.gz: fae7985e7626548eaaffc903509a8829fb8a0cc985bfe8364c91bb543a1ec41f765ced9d9de6199bdffbec6a6c7e9e78c27504702725c1b6da5115004c58ea16
@@ -40,7 +40,13 @@ class LogStash::Filters::Ipam < LogStash::Filters::Base
40
40
  json = JSON.parse(file)
41
41
  subnets = json["subnets"]
42
42
 
43
- ip = IPAddr.new(@ip)
43
+ begin
44
+ ip = IPAddr.new(@ip)
45
+ rescue ArgumentError => e
46
+ @logger.warn("Invalid IP address, skipping", :address => @ip, :event => event)
47
+ nil
48
+ end
49
+
44
50
  subnets.each do |sub|
45
51
  if IPAddr.new(sub['subnet'] + "/" + sub['netmask'].to_s) === ip
46
52
  results.push(sub)
@@ -50,9 +56,8 @@ class LogStash::Filters::Ipam < LogStash::Filters::Base
50
56
  # Set field only if there is some subnets checked.
51
57
  if results.length > 0
52
58
  event.set(@field, results)
59
+ # filter_matched should go in the last line of our successful code
60
+ filter_matched(event)
53
61
  end
54
-
55
- # filter_matched should go in the last line of our successful code
56
- filter_matched(event)
57
62
  end # def filter
58
63
  end # class LogStash::Filters::Ipam
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-ipam'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Correlation with IPAM.'
6
6
  s.description = 'Filter that allows getting subnets from existing file extracted from IPAM for an IP address.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-ipam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corentin Dekimpe