logstash-filter-phpipam 0.7.3 → 0.7.4

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: f67a76c960e60bbf5528c6fadf0a1b6127ae8512fb538a8e56c11f8449ae60b4
4
- data.tar.gz: 1994b36ad823165f395cfcf25074f7964fcac483f3d6ef877832522d95845c33
3
+ metadata.gz: 8cccaae03423dbd8850ff132ecea6363b7bc8e30ff6bf60235aa5d858c177424
4
+ data.tar.gz: f200dae24960cacf205fb4ba0d1fcfdef3e0ccc9e6eae12d6a3177ad75c460eb
5
5
  SHA512:
6
- metadata.gz: 69a9b705746d79ced2ea692a1bd35870b102be28dedf238f827f5062e315768026d1d14946aff13a2b3e0a08625885339e8d40578129327ff8ab00b59a07dc48
7
- data.tar.gz: 54ae6ac859d39cd426dd140fb106a62aa5cbcc94e01306ba757cb8f9467e08fa8a4202bde1c781e3c2cddd45343b09446631ad00d8f62b7c92b47b1a8b30cb85
6
+ metadata.gz: ba0fa5d20b67d58b34f26beb98eccb33e3f3c32ecff03da3d0a5b9034c83262b3a710052fe8001f51019287c78f0f1a4d94bd1382d6f8d94d10d034a5fbb235d
7
+ data.tar.gz: 1ec14e3a6e9246dd45dbe40167a832a855138adcdbe36cc9f31c567167540ef2771c771596a13512fcf1113915c390e825dd70bae8df555ee07e6ab541061ea2
data/README.md CHANGED
@@ -4,7 +4,7 @@ A Logstash filter that looks up an IP-address, and returns results from phpIPAM
4
4
  ## Installation
5
5
  This plugin can be installed using the `logstash-plugin` command in $LOGSTASH_HOME:
6
6
  ```bash
7
- ${LOGSTASH_HOME}/bin/logstash-plugin install logstash-filter-phpipam
7
+ ${LOGSTASH_HOME:-/usr/share/logstash}/bin/logstash-plugin install logstash-filter-phpipam
8
8
  ```
9
9
 
10
10
  ## Configuration options
@@ -23,6 +23,22 @@ ${LOGSTASH_HOME}/bin/logstash-plugin install logstash-filter-phpipam
23
23
  `app_id` can be found in phpIPAM: Administration -> API \
24
24
  It's recommended to use SSL when accessing the app_id in phpIPAM.
25
25
 
26
+ ## Geo-points
27
+ By default the lon and lat are mapped as normal floats, NOT geo-points!
28
+
29
+ To use the latitude and longtitude in Kibana Maps, you either need to:
30
+ 1. Preload mappings yourself
31
+ 2. Use preloaded mappings from something like Filebeat (7.0+)
32
+
33
+ For option 2, if you use the default target of `phpipam`, you can do something like this, after the phpipam filter:
34
+ ```
35
+ mutate {
36
+ copy => {
37
+ "[phpipam][location][location]" => "[geo][location]"
38
+ }
39
+ }
40
+ ```
41
+
26
42
  ## Example
27
43
  This example...
28
44
  ```ruby
@@ -71,8 +87,8 @@ phpipam {
71
87
  "name" => "Null Island",
72
88
  "id" => 1,
73
89
  "location" => {
74
- "lat" => "0.000000",
75
- "lon" => "0.000000"
90
+ "lat" => 0.0,
91
+ "lon" => 0.0
76
92
  },
77
93
  "address" => "Null Island, Atlantic Ocean"
78
94
  }
@@ -50,6 +50,8 @@ class LogStash::Filters::Phpipam < LogStash::Filters::Base
50
50
  def filter(event)
51
51
  ip = event.get(@source)
52
52
 
53
+ return if ip.nil?
54
+
53
55
  return unless valid_ip?(ip, event)
54
56
 
55
57
  # Get data from cache or phpIPAM if not in cache
@@ -236,7 +238,7 @@ class LogStash::Filters::Phpipam < LogStash::Filters::Base
236
238
  base['location']['address'] = location_data['address'] unless nil_or_empty?(location_data['address'])
237
239
  base['location']['name'] = location_data['name'] unless nil_or_empty?(location_data['name'])
238
240
  base['location']['description'] = location_data['description'] unless nil_or_empty?(location_data['description'])
239
- base['location']['location'] = { 'lat' => location_data['lat'], 'lon' => location_data['long'] } unless nil_or_empty?(location_data['lat'])
241
+ base['location']['location'] = { 'lat' => location_data['lat'].to_f, 'lon' => location_data['long'].to_f } unless nil_or_empty?(location_data['lat'])
240
242
  end
241
243
 
242
244
  # Cache it for future needs
@@ -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.3'
5
+ s.version = '0.7.4'
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.3
4
+ version: 0.7.4
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-08 00:00:00.000000000 Z
11
+ date: 2019-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api