logstash-filter-ip2location 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: dfa0834d82fd5dd60221508d1ab23b574c1c9692
4
- data.tar.gz: 765b7d1d1d2efa5babd36b2a427dc48ef24a384e
3
+ metadata.gz: e14af9fe1c77455ad3edbc6d0408f663b4f7db50
4
+ data.tar.gz: ee905119c82b65ed05f0c7ffdcf471ba41a53207
5
5
  SHA512:
6
- metadata.gz: 34faab4251e46900097ca5c17dace085a46d6ff8c9a5230cc9713700ee06c042831ec27f7e424b4ccf11c921d5b143c6f364004bcdefe0b291fae926b2e81cf4
7
- data.tar.gz: a65542b74c32436ef4166fb7c469f97f7606c0bf94fab6b32675cb004d4831a3401c633535d297b67dd8134e6b26ac6347f149e7203076e724d64d4bd89a7559
6
+ metadata.gz: 8169aea768367e1178a5edceb76501726deff71fd7466ebcb3959e6a721287cbb7f66443d66e390f29db221210cf5d2d693a999e520b29c2fe1f914e80a15e11
7
+ data.tar.gz: 5cdc1daf13e891c3d9fff485b0af278cb3ced3817227146836027bef563f2670cf416f6dc9271bdda4624b5ebec6f6e3e301a278f038728db3580d6499d77256
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
- use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
-
8
- if Dir.exist?(logstash_path) && use_logstash_source
9
- gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
- gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
- end
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
data/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright (c) 2017 IP2Location.com
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright (c) 2017 IP2Location.com
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
data/README.md CHANGED
@@ -1,35 +1,89 @@
1
- # IP2Location Filter Plugin
2
- This is IP2Location filter plugin for Logstash that enables Logstash's users to add geolocation information such as country, region, city, latitude, longitude, ZIP code, time zone, Internet Service Provider (ISP), domain name, connection speed, IDD code, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC), mobile brand, elevation, and usage type by IP address. The library reads the geo location information from **IP2Location BIN data** file.
3
-
4
- Supported IPv4 and IPv6 address.
5
-
6
-
7
- ## Dependencies (IP2LOCATION BIN DATA FILE)
8
- This plugin requires IP2Location BIN data file to function. You may download the BIN data file at
9
- * IP2Location LITE BIN Data (Free): https://lite.ip2location.com
10
- * IP2Location Commercial BIN Data (Comprehensive): https://www.ip2location.com/software/java-component
11
-
12
-
13
- ## Installation
14
- Install this plugin by the following code:
15
- ```
16
- bin/logstash-plugin install logstash-filter-ip2location
17
- ```
18
-
19
-
20
- ## IP2Location Filter Configuration
21
- |Setting|Input type|Required|
22
- |---|---|---|
23
- |source|string|Yes|
24
- |database|a valid filesystem path|No|
25
- |license|string|No|
26
-
27
- * **source** field is a required setting that containing the IP address or hostname to get the ip information.
28
- * **database** field is an optional setting that containing the path to the IP2Location BIN database file.
29
- * **license** field is an optional setting that containing the license key value to remove the random 5 second delay in demo version.
30
-
31
-
32
- ## Support
33
- Email: support@ip2location.com
34
-
35
- URL: [https://www.ip2location.com](https://www.ip2location.com)
1
+ # IP2Location Filter Plugin
2
+ This is IP2Location filter plugin for Logstash that enables Logstash's users to add geolocation information such as country, region, city, latitude, longitude, ZIP code, time zone, Internet Service Provider (ISP), domain name, connection speed, IDD code, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC), mobile brand, elevation, and usage type by IP address. The library reads the geo location information from **IP2Location BIN data** file.
3
+
4
+ Supported IPv4 and IPv6 address.
5
+
6
+ For the methods to use IP2Location filter plugin with ELK (Elasticsearch, Logstash, and Kibana), please take a look on this [tutorial](https://www.ip2location.com/tutorials/how-to-use-ip2location-filter-plugin-with-elk).
7
+
8
+
9
+ ## Sample Output
10
+ ![Example of data](https://www.ip2location.com/images/tutorial/logstash-filter-ip2location-screenshot2.png)
11
+
12
+ |Field|Description|
13
+ |---|---|
14
+ |ip2location.area_code|the varying length number assigned to geographic areas for call between cities|
15
+ |ip2location.city|the city name|
16
+ |ip2location.country_long|the country name based on ISO 3166|
17
+ |ip2location.country_short|the two-character country code based on ISO 3166|
18
+ |ip2location.domain|the Internet domain name associated to IP address range|
19
+ |ip2location.elevation|the elevation|
20
+ |ip2location.idd_code|the IDD prefix to call the city from another country|
21
+ |ip2location.ip_address|the IP address|
22
+ |ip2location.isp|the Internet Service Provider (ISP) name|
23
+ |ip2location.latitude|the city latitude|
24
+ |ip2location.longitude|the city longitude|
25
+ |ip2location.mcc|the mobile country code|
26
+ |ip2location.mnc|mobile network code|
27
+ |ip2location.mobile_brand|the mobile brand|
28
+ |ip2location.net_speed|the Internet Connection Speed (DIAL) DIAL-UP,(DSL) DSL/CABLE or(COMP) COMPANY|
29
+ |ip2location.region|the region or state name|
30
+ |ip2location.time_zone|the Time zone in UTC (Coordinated Universal Time)|
31
+ |ip2location.usage_type|the usage type|
32
+ |ip2location.weather_station_code|the special code to identify the nearest weather observation station|
33
+ |ip2location.weather_station_name|the name of the nearest weather observation station|
34
+ |ip2location.zip_code|the ZIP code|
35
+
36
+
37
+ ## Dependencies (IP2LOCATION BIN DATA FILE)
38
+ This plugin requires IP2Location BIN data file to function. You may download the BIN data file at
39
+ * IP2Location LITE BIN Data (Free): https://lite.ip2location.com
40
+ * IP2Location Commercial BIN Data (Commercial): https://www.ip2location.com
41
+
42
+
43
+ ## Installation
44
+ Install this plugin by the following code:
45
+ ```
46
+ bin/logstash-plugin install logstash-filter-ip2location
47
+ ```
48
+
49
+
50
+ ## Config File Example
51
+ ```
52
+ input {
53
+ beats {
54
+ port => "5043"
55
+ }
56
+ }
57
+
58
+ filter {
59
+ grok {
60
+ match => { "message" => "%{COMBINEDAPACHELOG}"}
61
+ }
62
+ ip2location {
63
+ source => "clientip"
64
+ }
65
+ }
66
+
67
+
68
+ output {
69
+ elasticsearch {
70
+ hosts => [ "localhost:9200" ]
71
+ }
72
+ }
73
+ ```
74
+
75
+
76
+ ## IP2Location Filter Configuration
77
+ |Setting|Input type|Required|
78
+ |---|---|---|
79
+ |source|string|Yes|
80
+ |database|a valid filesystem path|No|
81
+
82
+ * **source** field is a required setting that containing the IP address or hostname to get the ip information.
83
+ * **database** field is an optional setting that containing the path to the IP2Location BIN database file.
84
+
85
+
86
+ ## Support
87
+ Email: support@ip2location.com
88
+
89
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
@@ -1,3 +1,3 @@
1
- require 'jar_dependencies'
2
- require_jar('com.ip2location.ip2location', 'ip2location', '8.0.2')
3
- require_jar('org.logstash.filters', 'logstash-filter-ip2location', '1.0.1')
1
+ require 'jar_dependencies'
2
+ require_jar('com.ip2location.ip2location', 'ip2location', '8.0.3')
3
+ require_jar('org.logstash.filters', 'logstash-filter-ip2location', '1.0.2')
@@ -1,54 +1,50 @@
1
- # encoding: utf-8
2
- require "logstash/filters/base"
3
- require "logstash/namespace"
4
-
5
- require "logstash-filter-ip2location_jars"
6
-
7
- class LogStash::Filters::IP2Location < LogStash::Filters::Base
8
- config_name "ip2location"
9
-
10
- # The path to the IP2Location.BIN database file which Logstash should use.
11
- # If not specified, this will default to the IP2LOCATION-LITE-DB3.IPV6.BIN database that embedded in the plugin.
12
- config :database, :validate => :path
13
-
14
- # The field containing the IP address.
15
- # If this field is an array, only the first value will be used.
16
- config :source, :validate => :string, :required => true
17
-
18
- # The field used to define iplocation as target.
19
- config :target, :validate => :string, :default => 'ip2location'
20
-
21
- # The field containing the license key.
22
- # If this field is provided, The random 5-second delay will be removed.
23
- config :license, :validate => :string, :default => ''
24
-
25
- public
26
- def register
27
- if @database.nil?
28
- @database = ::Dir.glob(::File.join(::File.expand_path("../../../vendor/", ::File.dirname(__FILE__)),"IP2LOCATION-LITE-DB3.IPV6.BIN")).first
29
-
30
- if @database.nil? || !File.exists?(@database)
31
- raise "You must specify 'database => ...' in your ip2location filter (I looked for '#{@database}')"
32
- end
33
- end
34
-
35
- @logger.info("Using ip2location database", :path => @database)
36
-
37
- @ip2locationfilter = org.logstash.filters.IP2LocationFilter.new(@source, @target, @database, @license)
38
- end
39
-
40
- public
41
- def filter(event)
42
- return unless filter?(event)
43
- if @ip2locationfilter.handleEvent(event)
44
- filter_matched(event)
45
- else
46
- tag_iplookup_unsuccessful(event)
47
- end
48
- end
49
-
50
- def tag_iplookup_unsuccessful(event)
51
- @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event)
52
- end
53
-
54
- end # class LogStash::Filters::IP2Location
1
+ # encoding: utf-8
2
+ require "logstash/filters/base"
3
+ require "logstash/namespace"
4
+
5
+ require "logstash-filter-ip2location_jars"
6
+
7
+ class LogStash::Filters::IP2Location < LogStash::Filters::Base
8
+ config_name "ip2location"
9
+
10
+ # The path to the IP2Location.BIN database file which Logstash should use.
11
+ # If not specified, this will default to the IP2LOCATION-LITE-DB3.IPV6.BIN database that embedded in the plugin.
12
+ config :database, :validate => :path
13
+
14
+ # The field containing the IP address.
15
+ # If this field is an array, only the first value will be used.
16
+ config :source, :validate => :string, :required => true
17
+
18
+ # The field used to define iplocation as target.
19
+ config :target, :validate => :string, :default => 'ip2location'
20
+
21
+ public
22
+ def register
23
+ if @database.nil?
24
+ @database = ::Dir.glob(::File.join(::File.expand_path("../../../vendor/", ::File.dirname(__FILE__)),"IP2LOCATION-LITE-DB3.IPV6.BIN")).first
25
+
26
+ if @database.nil? || !File.exists?(@database)
27
+ raise "You must specify 'database => ...' in your ip2location filter (I looked for '#{@database}')"
28
+ end
29
+ end
30
+
31
+ @logger.info("Using ip2location database", :path => @database)
32
+
33
+ @ip2locationfilter = org.logstash.filters.IP2LocationFilter.new(@source, @target, @database)
34
+ end
35
+
36
+ public
37
+ def filter(event)
38
+ return unless filter?(event)
39
+ if @ip2locationfilter.handleEvent(event)
40
+ filter_matched(event)
41
+ else
42
+ tag_iplookup_unsuccessful(event)
43
+ end
44
+ end
45
+
46
+ def tag_iplookup_unsuccessful(event)
47
+ @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event)
48
+ end
49
+
50
+ end # class LogStash::Filters::IP2Location
@@ -1,25 +1,25 @@
1
- Gem::Specification.new do |s|
2
-
3
- s.name = 'logstash-filter-ip2location'
4
- s.version = '1.0.1'
5
- s.licenses = ['Apache License (2.0)']
6
- s.summary = "Logstash filter IP2Location"
7
- s.description = "IP2Location filter plugin for Logstash enables Logstash's users to add geolocation information such as country, state, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection speed, IDD code, area code, weather station code, weather station name, MNC, MCC, mobile brand, elevation and usage type by IP address."
8
- s.authors = ["IP2Location"]
9
- s.email = 'support@ip2location.com'
10
- s.homepage = "https://www.ip2location.com"
11
- s.require_paths = ["lib", "vendor/jar-dependencies"]
12
-
13
- # Files
14
- s.files = Dir["lib/**/*",'spec/**/*',"vendor/**/*","vendor/jar-dependencies/**/*.jar","*.gemspec","*.md","Gemfile","LICENSE"]
15
-
16
- # Tests
17
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
-
19
- # Special flag to let us know this is actually a logstash plugin
20
- s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
-
22
- # Gem dependencies
23
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
24
- s.add_development_dependency "logstash-devutils"
25
- end
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-filter-ip2location'
4
+ s.version = '1.0.2'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "Logstash filter IP2Location"
7
+ s.description = "IP2Location filter plugin for Logstash enables Logstash's users to add geolocation information such as country, state, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection speed, IDD code, area code, weather station code, weather station name, MNC, MCC, mobile brand, elevation and usage type by IP address."
8
+ s.authors = ["IP2Location"]
9
+ s.email = 'support@ip2location.com'
10
+ s.homepage = "https://www.ip2location.com"
11
+ s.require_paths = ["lib", "vendor/jar-dependencies"]
12
+
13
+ # Files
14
+ s.files = Dir["lib/**/*",'spec/**/*',"vendor/**/*","vendor/jar-dependencies/**/*.jar","*.gemspec","*.md","Gemfile","LICENSE"]
15
+
16
+ # Tests
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ # Special flag to let us know this is actually a logstash plugin
20
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
24
+ s.add_development_dependency "logstash-devutils"
25
+ end
@@ -1,2 +1,2 @@
1
- # encoding: utf-8
2
- require "logstash/devutils/rspec/spec_helper"
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-ip2location
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - IP2Location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-01 00:00:00.000000000 Z
11
+ date: 2017-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api
@@ -57,8 +57,8 @@ files:
57
57
  - spec/filters/ip2location_spec.rb
58
58
  - spec/spec_helper.rb
59
59
  - vendor/IP2LOCATION-LITE-DB3.IPV6.BIN
60
- - vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.0.2/ip2location-8.0.2.jar
61
- - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/1.0.1/logstash-filter-ip2location-1.0.1.jar
60
+ - vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.0.3/ip2location-8.0.3.jar
61
+ - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/1.0.2/logstash-filter-ip2location-1.0.2.jar
62
62
  homepage: https://www.ip2location.com
63
63
  licenses:
64
64
  - Apache License (2.0)