logstash-filter-ip2location 1.0.3 → 1.1.0

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: eb5215e6f1580d59313b0525104e612219c879fc
4
- data.tar.gz: f5a116257db7d3d6e48c7daeb6f445276ee665f4
3
+ metadata.gz: 182689a84724ac812b556c4f0072b4673b7cb82b
4
+ data.tar.gz: 4ac5a8d3b65c417c2284fa1c72e27dd0b9404d3b
5
5
  SHA512:
6
- metadata.gz: a1ec379054e4e326e81a2054f52c7b49d7af830f328641d1a2579605caa10059ae5e6ee3d5eebb2a62b1cc620cb64d37c5aae42462c4ed738ea83e5ed456f7f6
7
- data.tar.gz: 306966e50bbc68397d5ebfae0b8c422694dad97a3e5fa821717422e2fbd44d4b1fcbcedfb3ec6b41dd44ee7123ef9137292ebd1caaec119a04fa517b1236438e
6
+ metadata.gz: 4c19320e9fdb7447211a3030b622f14ca370d67daf9b41f0d6491b076163f8b12bdbd16c7186fab9068e2fc49abbc678403869f99566ff216223a8aadf09bf05
7
+ data.tar.gz: 03156e6e53e4e5db86ba9d5d838cd37552229264817d71b32df349ff04b707a5c49a0f5c22aa300b57a774f0cece1107fe0838cf0c9aae3540aaae7aa4b08fbd
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) 2018 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,90 +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
- For the methods to use IP2Location filter plugin with Elastic Stack (Elasticsearch, Filebeat, Logstash, and Kibana), please take a look on this [tutorial](https://www.ip2location.com/tutorials/how-to-use-ip2location-filter-plugin-with-elastic-stack).
7
-
8
-
9
- ## Dependencies (IP2LOCATION BIN DATA FILE)
10
- This plugin requires IP2Location BIN data file to function. You may download the BIN data file at
11
- * IP2Location LITE BIN Data (Free): https://lite.ip2location.com
12
- * IP2Location Commercial BIN Data (Commercial): https://www.ip2location.com
13
-
14
-
15
- ## Installation
16
- Install this plugin by the following code:
17
- ```
18
- bin/logstash-plugin install logstash-filter-ip2location
19
- ```
20
-
21
-
22
- ## Config File Example
23
- ```
24
- input {
25
- beats {
26
- port => "5043"
27
- }
28
- }
29
-
30
- filter {
31
- grok {
32
- match => { "message" => "%{COMBINEDAPACHELOG}"}
33
- }
34
- ip2location {
35
- source => "clientip"
36
- }
37
- }
38
-
39
-
40
- output {
41
- elasticsearch {
42
- hosts => [ "localhost:9200" ]
43
- }
44
- }
45
- ```
46
-
47
-
48
- ## IP2Location Filter Configuration
49
- |Setting|Input type|Required|
50
- |---|---|---|
51
- |source|string|Yes|
52
- |database|a valid filesystem path|No|
53
-
54
- * **source** field is a required setting that containing the IP address or hostname to get the ip information.
55
- * **database** field is an optional setting that containing the path to the IP2Location BIN database file.
56
-
57
-
58
- ## Sample Output
59
- |Field|Description|
60
- |---|---|
61
- |ip2location.area_code|the varying length number assigned to geographic areas for call between cities|
62
- |ip2location.city|the city name|
63
- |ip2location.country_long|the country name based on ISO 3166|
64
- |ip2location.country_short|the two-character country code based on ISO 3166|
65
- |ip2location.domain|the Internet domain name associated to IP address range|
66
- |ip2location.elevation|the elevation|
67
- |ip2location.idd_code|the IDD prefix to call the city from another country|
68
- |ip2location.ip_address|the IP address|
69
- |ip2location.isp|the Internet Service Provider (ISP) name|
70
- |ip2location.latitude|the city latitude|
71
- |ip2location.longitude|the city longitude|
72
- |ip2location.location|the location of city|
73
- |ip2location.mcc|the mobile country code|
74
- |ip2location.mnc|mobile network code|
75
- |ip2location.mobile_brand|the mobile brand|
76
- |ip2location.net_speed|the Internet Connection Speed (DIAL) DIAL-UP,(DSL) DSL/CABLE or(COMP) COMPANY|
77
- |ip2location.region|the region or state name|
78
- |ip2location.time_zone|the Time zone in UTC (Coordinated Universal Time)|
79
- |ip2location.usage_type|the usage type|
80
- |ip2location.weather_station_code|the special code to identify the nearest weather observation station|
81
- |ip2location.weather_station_name|the name of the nearest weather observation station|
82
- |ip2location.zip_code|the ZIP code|
83
-
84
- ![Example of data](https://www.ip2location.com/images/tutorial/logstash-filter-ip2location-screenshot2.png?)
85
-
86
-
87
- ## Support
88
- Email: support@ip2location.com
89
-
90
- 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 Elastic Stack (Elasticsearch, Filebeat, Logstash, and Kibana), please take a look on this [tutorial](https://www.ip2location.com/tutorials/how-to-use-ip2location-filter-plugin-with-elastic-stack).
7
+
8
+
9
+ ## Dependencies (IP2LOCATION BIN DATA FILE)
10
+ This plugin requires IP2Location BIN data file to function. You may download the BIN data file at
11
+ * IP2Location LITE BIN Data (Free): https://lite.ip2location.com
12
+ * IP2Location Commercial BIN Data (Commercial): https://www.ip2location.com
13
+
14
+
15
+ ## Installation
16
+ Install this plugin by the following code:
17
+ ```
18
+ bin/logstash-plugin install logstash-filter-ip2location
19
+ ```
20
+
21
+
22
+ ## Config File Example
23
+ ```
24
+ input {
25
+ beats {
26
+ port => "5043"
27
+ }
28
+ }
29
+
30
+ filter {
31
+ grok {
32
+ match => { "message" => "%{COMBINEDAPACHELOG}"}
33
+ }
34
+ ip2location {
35
+ source => "clientip"
36
+ }
37
+ }
38
+
39
+
40
+ output {
41
+ elasticsearch {
42
+ hosts => [ "localhost:9200" ]
43
+ }
44
+ }
45
+ ```
46
+
47
+
48
+ ## IP2Location Filter Configuration
49
+ |Setting|Input type|Required|
50
+ |---|---|---|
51
+ |source|string|Yes|
52
+ |database|a valid filesystem path|No|
53
+
54
+ * **source** field is a required setting that containing the IP address or hostname to get the ip information.
55
+ * **database** field is an optional setting that containing the path to the IP2Location BIN database file.
56
+
57
+
58
+ ## Sample Output
59
+ |Field|Description|
60
+ |---|---|
61
+ |ip2location.area_code|the varying length number assigned to geographic areas for call between cities|
62
+ |ip2location.city|the city name|
63
+ |ip2location.country_long|the country name based on ISO 3166|
64
+ |ip2location.country_short|the two-character country code based on ISO 3166|
65
+ |ip2location.domain|the Internet domain name associated to IP address range|
66
+ |ip2location.elevation|the elevation|
67
+ |ip2location.idd_code|the IDD prefix to call the city from another country|
68
+ |ip2location.ip_address|the IP address|
69
+ |ip2location.isp|the Internet Service Provider (ISP) name|
70
+ |ip2location.latitude|the city latitude|
71
+ |ip2location.longitude|the city longitude|
72
+ |ip2location.mcc|the mobile country code|
73
+ |ip2location.mnc|mobile network code|
74
+ |ip2location.mobile_brand|the mobile brand|
75
+ |ip2location.net_speed|the Internet Connection Speed (DIAL) DIAL-UP,(DSL) DSL/CABLE or(COMP) COMPANY|
76
+ |ip2location.region|the region or state name|
77
+ |ip2location.time_zone|the Time zone in UTC (Coordinated Universal Time)|
78
+ |ip2location.usage_type|the usage type|
79
+ |ip2location.weather_station_code|the special code to identify the nearest weather observation station|
80
+ |ip2location.weather_station_name|the name of the nearest weather observation station|
81
+ |ip2location.zip_code|the ZIP code|
82
+
83
+ ![Example of data](https://www.ip2location.com/images/tutorial/logstash-filter-ip2location-screenshot2.png?)
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.3')
3
- require_jar('org.logstash.filters', 'logstash-filter-ip2location', '1.0.3')
1
+ require 'jar_dependencies'
2
+ require_jar('com.ip2location.ip2location', 'ip2location', '8.0.3')
3
+ require_jar('org.logstash.filters', 'logstash-filter-ip2location', '1.1.0')
@@ -1,50 +1,160 @@
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
+ # encoding: utf-8
2
+ require "logstash/filters/base"
3
+ require "logstash/namespace"
4
+
5
+ require "logstash-filter-ip2location_jars"
6
+ require "json"
7
+
8
+ require 'thread'
9
+
10
+
11
+ class LogStash::Filters::IP2Location < LogStash::Filters::Base
12
+ config_name "ip2location"
13
+
14
+ # The path to the IP2Location.BIN database file which Logstash should use.
15
+ # If not specified, this will default to the IP2LOCATION-LITE-DB3.IPV6.BIN database that embedded in the plugin.
16
+ config :database, :validate => :path
17
+
18
+ # The field containing the IP address.
19
+ # If this field is an array, only the first value will be used.
20
+ config :source, :validate => :string, :required => true
21
+
22
+ # The field used to define iplocation as target.
23
+ config :target, :validate => :string, :default => 'ip2location'
24
+
25
+ # The field used to define the size of the cache. It is not required and the default value is 10 000
26
+ config :cache_size, :validate => :number, :required => false, :default => 10_000
27
+
28
+ public
29
+ def register
30
+ if @database.nil?
31
+ @database = ::Dir.glob(::File.join(::File.expand_path("../../../vendor/", ::File.dirname(__FILE__)),"IP2LOCATION-LITE-DB3.IPV6.BIN")).first
32
+
33
+ if @database.nil? || !File.exists?(@database)
34
+ raise "You must specify 'database => ...' in your ip2location filter (I looked for '#{@database}')"
35
+ end
36
+ end
37
+
38
+ @logger.info("Using ip2location database", :path => @database)
39
+
40
+ @ip2locationfilter = org.logstash.filters.IP2LocationFilter.new(@source, @target, @database)
41
+ end
42
+
43
+ public
44
+ def filter(event)
45
+ json = JSON.parse(event.to_json)
46
+ ip = json["clientip"]
47
+
48
+ return unless filter?(event)
49
+ if value = Cache.find(event, ip, @ip2locationfilter, @cache_size).get('ip2location')
50
+ event.set('ip2location', value)
51
+ filter_matched(event)
52
+ else
53
+ tag_iplookup_unsuccessful(event)
54
+ end
55
+ end
56
+
57
+ def tag_iplookup_unsuccessful(event)
58
+ @logger.debug? && @logger.debug("IP #{event.get(@source)} was not found in the database", :event => event)
59
+ end
60
+
61
+ end # class LogStash::Filters::IP2Location
62
+
63
+ class OrderedHash
64
+ ONE = 1
65
+
66
+ attr_reader :times_queried # ip -> times queried
67
+ attr_reader :hash
68
+
69
+ def initialize
70
+ @times_queried = Hash.new(0) # ip -> times queried
71
+ @hash = {} # number of hits -> array of ips
72
+ end
73
+
74
+ def add(key)
75
+ hash[ONE] ||= []
76
+ hash[ONE] << key
77
+ times_queried[key] = ONE
78
+ end
79
+
80
+ def reorder(key)
81
+ number_of_queries = times_queried[key]
82
+
83
+ hash[number_of_queries].delete(key)
84
+ hash.delete(number_of_queries) if hash[number_of_queries].empty?
85
+
86
+ hash[number_of_queries + 1] ||= []
87
+ hash[number_of_queries + 1] << key
88
+ end
89
+
90
+ def increment(key)
91
+ add(key) unless times_queried.has_key?(key)
92
+ reorder(key)
93
+ times_queried[key] += 1
94
+ end
95
+
96
+ def delete_least_used
97
+ first_pile_with_someting.shift.tap { |key| times_queried.delete(key) }
98
+ end
99
+
100
+ def first_pile_with_someting
101
+ hash[hash.keys.min]
102
+ end
103
+ end
104
+
105
+ class Cache
106
+ ONE_DAY_IN_SECONDS = 86_400
107
+
108
+ @cache = {} # ip -> event
109
+ @timestamps = {} # ip -> time of caching
110
+ @times_queried = OrderedHash.new # ip -> times queried
111
+ @mutex = Mutex.new
112
+
113
+ class << self
114
+ attr_reader :cache
115
+ attr_reader :timestamps
116
+ attr_reader :times_queried
117
+
118
+
119
+ def find(event, ip, filter, cache_size)
120
+ synchronize do
121
+ if cache.has_key?(ip)
122
+ refresh_event(ip) if too_old?(ip)
123
+ else
124
+ if cache_full?(cache_size)
125
+ make_room
126
+ end
127
+ cache_event(event, ip, filter)
128
+ end
129
+ times_queried.increment(ip)
130
+ cache[ip]
131
+ end
132
+ end
133
+
134
+ def too_old?(ip)
135
+ timestamps[ip] < Time.now - ONE_DAY_IN_SECONDS
136
+ end
137
+
138
+ def make_room
139
+ key = times_queried.delete_least_used
140
+ cache.delete(key)
141
+ timestamps.delete(key)
142
+ end
143
+
144
+ def cache_full?(cache_size)
145
+ cache.size >= cache_size
146
+ end
147
+
148
+ def cache_event(event, ip, filter)
149
+ filter.handleEvent(event)
150
+ cache[ip] = event
151
+ timestamps[ip] = Time.now
152
+ end
153
+
154
+ def synchronize(&block)
155
+ @mutex.synchronize(&block)
156
+ end
157
+
158
+ alias_method :refresh_event, :cache_event
159
+ end
160
+ end
@@ -1,25 +1,25 @@
1
- Gem::Specification.new do |s|
2
-
3
- s.name = 'logstash-filter-ip2location'
4
- s.version = '1.0.3'
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.1.0'
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,32 +1,32 @@
1
- # encoding: utf-8
2
- require_relative '../spec_helper'
3
- require "logstash/filters/ip2location"
4
-
5
- IP2LOCATIONDB = ::Dir.glob(::File.expand_path("../../vendor/", ::File.dirname(__FILE__))+"/IP2LOCATION-LITE-DB3.IPV6.BIN").first
6
-
7
- describe LogStash::Filters::IP2Location do
8
-
9
- describe "normal test" do
10
- config <<-CONFIG
11
- filter {
12
- ip2location {
13
- source => "ip"
14
- #database => "#{IP2LOCATIONDB}"
15
- }
16
- }
17
- CONFIG
18
-
19
- sample("ip" => "8.8.8.8") do
20
- expect(subject.get("ip2location")).not_to be_empty
21
- expect(subject.get("ip2location")["country_short"]).to eq("US")
22
- end
23
- end
24
-
25
- sample("ip" => "2a01:04f8:0d16:26c2::") do
26
- expect(subject.get("ip2location")).not_to be_empty
27
- expect(subject.get("ip2location")["country_short"]).to eq("DE")
28
- end
29
- end
30
- end
31
-
1
+ # encoding: utf-8
2
+ require_relative '../spec_helper'
3
+ require "logstash/filters/ip2location"
4
+
5
+ IP2LOCATIONDB = ::Dir.glob(::File.expand_path("../../vendor/", ::File.dirname(__FILE__))+"/IP2LOCATION-LITE-DB3.IPV6.BIN").first
6
+
7
+ describe LogStash::Filters::IP2Location do
8
+
9
+ describe "normal test" do
10
+ config <<-CONFIG
11
+ filter {
12
+ ip2location {
13
+ source => "ip"
14
+ #database => "#{IP2LOCATIONDB}"
15
+ }
16
+ }
17
+ CONFIG
18
+
19
+ sample("ip" => "8.8.8.8") do
20
+ expect(subject.get("ip2location")).not_to be_empty
21
+ expect(subject.get("ip2location")["country_short"]).to eq("US")
22
+ end
23
+ end
24
+
25
+ sample("ip" => "2a01:04f8:0d16:26c2::") do
26
+ expect(subject.get("ip2location")).not_to be_empty
27
+ expect(subject.get("ip2location")["country_short"]).to eq("DE")
28
+ end
29
+ end
30
+ end
31
+
32
32
  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.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - IP2Location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core-plugin-api
@@ -58,7 +58,7 @@ files:
58
58
  - spec/spec_helper.rb
59
59
  - vendor/IP2LOCATION-LITE-DB3.IPV6.BIN
60
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.3/logstash-filter-ip2location-1.0.3.jar
61
+ - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/1.1.0/logstash-filter-ip2location-1.1.0.jar
62
62
  homepage: https://www.ip2location.com
63
63
  licenses:
64
64
  - Apache License (2.0)