logstash-filter-phpipam 0.7.3 → 0.7.4
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/README.md +19 -3
- data/lib/logstash/filters/phpipam.rb +3 -1
- data/logstash-filter-phpipam.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cccaae03423dbd8850ff132ecea6363b7bc8e30ff6bf60235aa5d858c177424
|
4
|
+
data.tar.gz: f200dae24960cacf205fb4ba0d1fcfdef3e0ccc9e6eae12d6a3177ad75c460eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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" =>
|
75
|
-
"lon" =>
|
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.
|
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.
|
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-
|
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
|