logstash-filter-ipam 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/logstash/filters/ipam.rb +9 -4
- data/logstash-filter-ipam.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f160ac54f8bc792c5c8e532de086002091d27cc571784e3d9139001d5c9530d
|
4
|
+
data.tar.gz: 3ea8071243425f5e7426079c86f1f5ceeed4bc233d52abc1f7c98031a554d965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
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.'
|