logstash-filter-phpipam 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +77 -79
- data/lib/logstash/filters/phpipam.rb +3 -3
- 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: f67a76c960e60bbf5528c6fadf0a1b6127ae8512fb538a8e56c11f8449ae60b4
|
4
|
+
data.tar.gz: 1994b36ad823165f395cfcf25074f7964fcac483f3d6ef877832522d95845c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a9b705746d79ced2ea692a1bd35870b102be28dedf238f827f5062e315768026d1d14946aff13a2b3e0a08625885339e8d40578129327ff8ab00b59a07dc48
|
7
|
+
data.tar.gz: 54ae6ac859d39cd426dd140fb106a62aa5cbcc94e01306ba757cb8f9467e08fa8a4202bde1c781e3c2cddd45343b09446631ad00d8f62b7c92b47b1a8b30cb85
|
data/README.md
CHANGED
@@ -1,86 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# logstash-filter-phpipam
|
2
|
+
A Logstash filter that looks up an IP-address, and returns results from phpIPAM
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
## Documentation
|
8
|
-
|
9
|
-
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
10
|
-
|
11
|
-
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
12
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
13
|
-
|
14
|
-
## Need Help?
|
15
|
-
|
16
|
-
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
17
|
-
|
18
|
-
## Developing
|
19
|
-
|
20
|
-
### 1. Plugin Developement and Testing
|
21
|
-
|
22
|
-
#### Code
|
23
|
-
- To get started, you'll need JRuby with the Bundler gem installed.
|
24
|
-
|
25
|
-
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
|
26
|
-
|
27
|
-
- Install dependencies
|
28
|
-
```sh
|
29
|
-
bundle install
|
30
|
-
```
|
31
|
-
|
32
|
-
#### Test
|
33
|
-
|
34
|
-
- Update your dependencies
|
35
|
-
|
36
|
-
```sh
|
37
|
-
bundle install
|
4
|
+
## Installation
|
5
|
+
This plugin can be installed using the `logstash-plugin` command in $LOGSTASH_HOME:
|
6
|
+
```bash
|
7
|
+
${LOGSTASH_HOME}/bin/logstash-plugin install logstash-filter-phpipam
|
38
8
|
```
|
39
9
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
10
|
+
## Configuration options
|
11
|
+
| Option | Type | Default | Comment |
|
12
|
+
| ---------- | ------- | --------------------------------- | ------------------------------------------------------------------------------- |
|
13
|
+
| host | string | | What host to connect to with protocol and optional port(e.g. https://fqdn:3000) |
|
14
|
+
| app_id | string | | See below |
|
15
|
+
| username | string | | Username to use for the connection |
|
16
|
+
| password | string | | Password to use for the connection |
|
17
|
+
| auth | boolean | true | Whether to use authentication or not |
|
18
|
+
| cache | boolean | true | Whether to use a cache file or not |
|
19
|
+
| cache_path | string | /tmp/logstash-filter-phpipam.json | Where to place the cache file. tmpfs is recommended |
|
20
|
+
| source | string | | Which field the IP-address is in |
|
21
|
+
| target | string | phpipam | Where to place the phpIPAM data in |
|
22
|
+
|
23
|
+
`app_id` can be found in phpIPAM: Administration -> API \
|
24
|
+
It's recommended to use SSL when accessing the app_id in phpIPAM.
|
25
|
+
|
26
|
+
## Example
|
27
|
+
This example...
|
51
28
|
```ruby
|
52
|
-
|
29
|
+
phpipam {
|
30
|
+
host => "https://phpipam.local.domain"
|
31
|
+
app_id => "logstash"
|
32
|
+
username => "username"
|
33
|
+
password => "password"
|
34
|
+
source => "[source][ip]"
|
35
|
+
target => "[source][phpipam]"
|
36
|
+
}
|
53
37
|
```
|
54
|
-
|
55
|
-
```
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
38
|
+
...would produce:
|
39
|
+
```ruby
|
40
|
+
"source" => {
|
41
|
+
"phpipam" => {
|
42
|
+
"subnet" => {
|
43
|
+
"network" => "172.16.1.0",
|
44
|
+
"bitmask" => 24,
|
45
|
+
"netmask" => "255.255.255.0",
|
46
|
+
"section_id" => 1,
|
47
|
+
"wildcard" => "0.0.0.255",
|
48
|
+
"id" => 1
|
49
|
+
},
|
50
|
+
"ip" => {
|
51
|
+
"description" => "This is my test IP",
|
52
|
+
"hostname" => "test.domain.local",
|
53
|
+
"id" => 1,
|
54
|
+
"note" => "This switch is in test!",
|
55
|
+
"address" => "172.16.1.10",
|
56
|
+
"mac" => "aa:bb:cc:dd:ee:ff"
|
57
|
+
"owner" => "Testing Team"
|
58
|
+
},
|
59
|
+
"vlan" => {
|
60
|
+
"name" => "TestVLAN",
|
61
|
+
"number" => 100,
|
62
|
+
"id" => 1
|
63
|
+
},
|
64
|
+
"device" => {
|
65
|
+
"name" => "test.domain.local",
|
66
|
+
"description" => "Juniper Switch",
|
67
|
+
"type" => "Switch",
|
68
|
+
"id" => 1
|
69
|
+
},
|
70
|
+
"location" => {
|
71
|
+
"name" => "Null Island",
|
72
|
+
"id" => 1,
|
73
|
+
"location" => {
|
74
|
+
"lat" => "0.000000",
|
75
|
+
"lon" => "0.000000"
|
76
|
+
},
|
77
|
+
"address" => "Null Island, Atlantic Ocean"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
75
81
|
```
|
76
|
-
|
77
|
-
|
78
|
-
## Contributing
|
79
|
-
|
80
|
-
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
81
|
-
|
82
|
-
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
83
|
-
|
84
|
-
It is more important to the community that you are able to contribute.
|
82
|
+
Provided that all that information is entered in phpIPAM.
|
85
83
|
|
86
|
-
|
84
|
+
Empty values in phpIPAM will not be pulled, therefore the output can vary, depending on the information gathered from the IP-address.
|
@@ -53,8 +53,8 @@ class LogStash::Filters::Phpipam < LogStash::Filters::Base
|
|
53
53
|
return unless valid_ip?(ip, event)
|
54
54
|
|
55
55
|
# Get data from cache or phpIPAM if not in cache
|
56
|
-
event_data = search_cache(ip)
|
57
|
-
event_data = phpipam_data(ip, event)
|
56
|
+
event_data = search_cache(ip) if @cache
|
57
|
+
event_data = phpipam_data(ip, event) unless event_data.is_a?(Hash)
|
58
58
|
|
59
59
|
return if !event_data['error'].nil? && event_data['error']
|
60
60
|
|
@@ -240,7 +240,7 @@ class LogStash::Filters::Phpipam < LogStash::Filters::Base
|
|
240
240
|
end
|
241
241
|
|
242
242
|
# Cache it for future needs
|
243
|
-
cache_data(base)
|
243
|
+
cache_data(base) if @cache
|
244
244
|
|
245
245
|
# all your base are belong to us
|
246
246
|
base
|
@@ -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.3'
|
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.3
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|