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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e6e9aa1f1006988029b971ee9b1fe5ca0659d13e33551781a742ca24d8289bf
4
- data.tar.gz: 85c6e272503003fafe0abf85a64f5acd04ae9abe5cb8bbb2d285303348bee2c2
3
+ metadata.gz: f67a76c960e60bbf5528c6fadf0a1b6127ae8512fb538a8e56c11f8449ae60b4
4
+ data.tar.gz: 1994b36ad823165f395cfcf25074f7964fcac483f3d6ef877832522d95845c33
5
5
  SHA512:
6
- metadata.gz: 60a7da9f65e044265062848f8fc12ac33c836192893095cb56fb06d7f0daba058774f11abc88c27954caaef39aa3be4e96b77bbd7486bbce0f5d6eb9e1448d50
7
- data.tar.gz: 3cdad24d903bb7922b666fbc890a0a7d6e64813f7f0ba7dbc6dc00cdc89e23ba8e266b6465a504d6a7e699e97af10ee5e7c8e628a6af35ca0fdefb4a41391731
6
+ metadata.gz: 69a9b705746d79ced2ea692a1bd35870b102be28dedf238f827f5062e315768026d1d14946aff13a2b3e0a08625885339e8d40578129327ff8ab00b59a07dc48
7
+ data.tar.gz: 54ae6ac859d39cd426dd140fb106a62aa5cbcc94e01306ba757cb8f9467e08fa8a4202bde1c781e3c2cddd45343b09446631ad00d8f62b7c92b47b1a8b30cb85
data/README.md CHANGED
@@ -1,86 +1,84 @@
1
- # Logstash Plugin
1
+ # logstash-filter-phpipam
2
+ A Logstash filter that looks up an IP-address, and returns results from phpIPAM
2
3
 
3
- This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
-
5
- It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
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
- - Run tests
41
-
42
- ```sh
43
- bundle exec rspec
44
- ```
45
-
46
- ### 2. Running your unpublished Plugin in Logstash
47
-
48
- #### 2.1 Run in a local Logstash clone
49
-
50
- - Edit Logstash `Gemfile` and add the local plugin path, for example:
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
- gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
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
- - Install plugin
55
- ```sh
56
- bin/logstash-plugin install --no-verify
57
- ```
58
- - Run Logstash with your plugin
59
- ```sh
60
- bin/logstash -e 'filter {awesome {}}'
61
- ```
62
- At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
63
-
64
- #### 2.2 Run in an installed Logstash
65
-
66
- You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
67
-
68
- - Build your plugin gem
69
- ```sh
70
- gem build logstash-filter-awesome.gemspec
71
- ```
72
- - Install the plugin from the Logstash home
73
- ```sh
74
- bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
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
- - Start Logstash and proceed to test the plugin
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
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
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) if event_data.is_a?(FalseClass)
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.2'
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.2
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-07 00:00:00.000000000 Z
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