logstash-filter-phpipam 0.7.1 → 0.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1958f973db608ec8a6d334f5ac17e7cdcc086090ec98edaa47581171ce69cd43
4
- data.tar.gz: 6cdd9bf4973d25c9e6436a8738841c906d59bf2ae92cd59097c06770fa04ba74
3
+ metadata.gz: 5e6e9aa1f1006988029b971ee9b1fe5ca0659d13e33551781a742ca24d8289bf
4
+ data.tar.gz: 85c6e272503003fafe0abf85a64f5acd04ae9abe5cb8bbb2d285303348bee2c2
5
5
  SHA512:
6
- metadata.gz: def36e7c9853d630b10f6bd483efdfcf60eff8be42462bb2bdbe75cfb6a5e0ed33bda0344d7f58b6176d379e1e3b25abb584b67662a71a106287309059916ab4
7
- data.tar.gz: b40a8985553daab7f1cba3321ffbcc786823dabf85e5a4977682bc1d5d0bb10fb2ccc7451ac885563a48a93eef08355d166a2a63f7112e9fcfc958125cf6c78f
6
+ metadata.gz: 60a7da9f65e044265062848f8fc12ac33c836192893095cb56fb06d7f0daba058774f11abc88c27954caaef39aa3be4e96b77bbd7486bbce0f5d6eb9e1448d50
7
+ data.tar.gz: 3cdad24d903bb7922b666fbc890a0a7d6e64813f7f0ba7dbc6dc00cdc89e23ba8e266b6465a504d6a7e699e97af10ee5e7c8e628a6af35ca0fdefb4a41391731
@@ -218,17 +218,21 @@ class LogStash::Filters::Phpipam < LogStash::Filters::Base
218
218
  base['device']['name'] = device_data['hostname'] unless nil_or_empty?(device_data['hostname'])
219
219
  base['device']['description'] = device_data['description'] unless nil_or_empty?(device_data['description'])
220
220
  base['device']['type'] = type['tname'] unless nil_or_empty?(type['tname'])
221
+ end
221
222
 
222
- # If the IP doesn't have the location directly, use the one from the device (if that has one)
223
- unless okay?(location_data)
224
- location_data = send_rest_request('GET', "api/#{@app_id}/tools/locations/#{device_data['location']}/") unless device_data['location'] == '0' || nil_or_empty?(device_data['location'])
225
- end
223
+ # If the IP doesn't have the location directly, try to get it from the device or subnet
224
+ unless okay?(location_data)
225
+ location_data = if okay?(device_data) && device_data['location'] != '0' && !nil_or_empty?(device_data['location'])
226
+ send_rest_request('GET', "api/#{@app_id}/tools/locations/#{device_data['location']}/")
227
+ elsif okay?(subnet_data) && subnet_data['location'] != '0' && !nil_or_empty?(subnet_data['location'])
228
+ send_rest_request('GET', "api/#{@app_id}/tools/locations/#{subnet_data['location']}/")
229
+ end
226
230
  end
227
231
 
228
232
  # Location information
229
233
  if okay?(location_data)
230
234
  base['location'] = {}
231
- base['location']['id'] = ip_data['location'].to_i
235
+ base['location']['id'] = location_data['id'].to_i
232
236
  base['location']['address'] = location_data['address'] unless nil_or_empty?(location_data['address'])
233
237
  base['location']['name'] = location_data['name'] unless nil_or_empty?(location_data['name'])
234
238
  base['location']['description'] = location_data['description'] unless nil_or_empty?(location_data['description'])
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'logstash-filter-phpipam'
5
- s.version = '0.7.1'
5
+ s.version = '0.7.2'
6
6
  s.licenses = ['Apache-2.0']
7
7
  s.summary = 'A Logstash filter that returns results from phpIPAM'
8
8
  s.description = 'A Logstash filter that looks up an IP-address, and returns results from phpIPAM'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-phpipam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - magnuslarsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api