logstash-filter-ip2location 2.1.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +8 -3
- data/lib/logstash/filters/ip2location.rb +19 -5
- data/lib/logstash-filter-ip2location_jars.rb +2 -2
- data/logstash-filter-ip2location.gemspec +1 -1
- data/vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.7.0/ip2location-8.7.0.jar +0 -0
- data/vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.3.0/logstash-filter-ip2location-2.3.0.jar +0 -0
- metadata +4 -4
- data/vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.3.0/ip2location-8.3.0.jar +0 -0
- data/vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.1.2/logstash-filter-ip2location-2.1.2.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8c7b8743669d98650fc8d4127e79c3928ed9cd08e53ebc99abe83c558ac3c58
|
4
|
+
data.tar.gz: aa45ac59325576bd3b795899ab3fea4fe0f0df94f1b27795bedcf47d613e5d1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb72ff92c07aac310f3eba6dbad4eeb87d693213ec38e8b2583b879984c8eeab5b30eb377fc6fc29f8857eaeaa0ac9485341c7b23c40f32c84c11aedf106489b
|
7
|
+
data.tar.gz: 50138ca65b141cd41c02e979343dac669af1b8b3ebe55d208a1def01cbea4b4970d8f03a0baae92e3178f777fa8f825bc52c137a77794fecd13a2409885a14a0
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
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,
|
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, usage type, address type and category by IP address. The library reads the geo location information from **IP2Location BIN data** file.
|
3
3
|
|
4
4
|
Supported IPv4 and IPv6 address.
|
5
5
|
|
@@ -81,16 +81,22 @@ output {
|
|
81
81
|
|source|string|Yes|
|
82
82
|
|database|a valid filesystem path|No|
|
83
83
|
|use_memory_mapped|boolean|No|
|
84
|
+
|use_cache|boolean|No|
|
85
|
+
|hide_unsupported_fields|boolean|No|
|
84
86
|
|
85
87
|
* **source** field is a required setting that containing the IP address or hostname to get the ip information.
|
86
88
|
* **database** field is an optional setting that containing the path to the IP2Location BIN database file.
|
87
89
|
* **use_memory_mapped** field is an optional setting that used to allow user to enable the use of memory mapped file. Default value is false.
|
90
|
+
* **use_cache** field is an optional setting that used to allow user to enable the use of cache. Default value is true.
|
91
|
+
* **hide_unsupported_fields** field is an optional setting that used to allow user to hide unsupported fields. Default value is false.
|
88
92
|
|
89
93
|
|
90
94
|
## Sample Output
|
91
95
|
|Field|Description|
|
92
96
|
|---|---|
|
97
|
+
|ip2location.address_type|the IP address type (A-Anycast, B-Broadcast, M-Multicast & U-Unicast) of IP address or domain name|
|
93
98
|
|ip2location.area_code|the varying length number assigned to geographic areas for call between cities|
|
99
|
+
|ip2location.category|the IAB content taxonomy category of IP address or domain name|
|
94
100
|
|ip2location.city|the city name|
|
95
101
|
|ip2location.country_long|the country name based on ISO 3166|
|
96
102
|
|ip2location.country_short|the two-character country code based on ISO 3166|
|
@@ -100,6 +106,7 @@ output {
|
|
100
106
|
|ip2location.ip_address|the IP address|
|
101
107
|
|ip2location.isp|the Internet Service Provider (ISP) name|
|
102
108
|
|ip2location.latitude|the city latitude|
|
109
|
+
|ip2location.location|the city location|
|
103
110
|
|ip2location.longitude|the city longitude|
|
104
111
|
|ip2location.mcc|the mobile country code|
|
105
112
|
|ip2location.mnc|mobile network code|
|
@@ -112,8 +119,6 @@ output {
|
|
112
119
|
|ip2location.weather_station_name|the name of the nearest weather observation station|
|
113
120
|
|ip2location.zip_code|the ZIP code|
|
114
121
|
|
115
|
-
![Example of data](https://www.ip2location.com/assets/img/logstash-filter-ip2location-screenshot2.png)
|
116
|
-
|
117
122
|
|
118
123
|
## Support
|
119
124
|
Email: support@ip2location.com
|
@@ -21,9 +21,15 @@ class LogStash::Filters::IP2Location < LogStash::Filters::Base
|
|
21
21
|
# The field used to define iplocation as target.
|
22
22
|
config :target, :validate => :string, :default => 'ip2location'
|
23
23
|
|
24
|
+
# The field used to allow user to enable the use of cache.
|
25
|
+
config :use_cache, :validate => :boolean, :default => true
|
26
|
+
|
24
27
|
# The field used to allow user to enable the use of memory mapped file.
|
25
28
|
config :use_memory_mapped, :validate => :boolean, :default => false
|
26
29
|
|
30
|
+
# The field used to allow user to hide unsupported fields.
|
31
|
+
config :hide_unsupported_fields, :validate => :boolean, :default => false
|
32
|
+
|
27
33
|
# The field used to define the size of the cache. It is not required and the default value is 10 000
|
28
34
|
config :cache_size, :validate => :number, :required => false, :default => 10_000
|
29
35
|
|
@@ -39,7 +45,7 @@ class LogStash::Filters::IP2Location < LogStash::Filters::Base
|
|
39
45
|
|
40
46
|
@logger.info("Using ip2location database", :path => @database)
|
41
47
|
|
42
|
-
@ip2locationfilter = org.logstash.filters.IP2LocationFilter.new(@source, @target, @database, @use_memory_mapped)
|
48
|
+
@ip2locationfilter = org.logstash.filters.IP2LocationFilter.new(@source, @target, @database, @use_memory_mapped, @hide_unsupported_fields)
|
43
49
|
end
|
44
50
|
|
45
51
|
public
|
@@ -47,11 +53,19 @@ class LogStash::Filters::IP2Location < LogStash::Filters::Base
|
|
47
53
|
ip = event.get(@source)
|
48
54
|
|
49
55
|
return unless filter?(event)
|
50
|
-
if
|
51
|
-
event.
|
52
|
-
|
56
|
+
if @use_cache
|
57
|
+
if value = Cache.find(event, ip, @ip2locationfilter, @cache_size).get('ip2location')
|
58
|
+
event.set('ip2location', value)
|
59
|
+
filter_matched(event)
|
60
|
+
else
|
61
|
+
tag_iplookup_unsuccessful(event)
|
62
|
+
end
|
53
63
|
else
|
54
|
-
|
64
|
+
if @ip2locationfilter.handleEvent(event)
|
65
|
+
filter_matched(event)
|
66
|
+
else
|
67
|
+
tag_iplookup_unsuccessful(event)
|
68
|
+
end
|
55
69
|
end
|
56
70
|
end
|
57
71
|
|
@@ -1,3 +1,3 @@
|
|
1
1
|
require 'jar_dependencies'
|
2
|
-
require_jar('com.ip2location.ip2location', 'ip2location', '8.
|
3
|
-
require_jar('org.logstash.filters', 'logstash-filter-ip2location', '2.
|
2
|
+
require_jar('com.ip2location.ip2location', 'ip2location', '8.7.0')
|
3
|
+
require_jar('org.logstash.filters', 'logstash-filter-ip2location', '2.3.0')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-ip2location'
|
4
|
-
s.version = '2.
|
4
|
+
s.version = '2.3.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Logstash filter IP2Location"
|
7
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."
|
data/vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.7.0/ip2location-8.7.0.jar
ADDED
Binary file
|
Binary file
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IP2Location
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-07 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-DB1.IPV6.BIN
|
60
|
-
- vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.
|
61
|
-
- vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.
|
60
|
+
- vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.7.0/ip2location-8.7.0.jar
|
61
|
+
- vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.3.0/logstash-filter-ip2location-2.3.0.jar
|
62
62
|
homepage: https://www.ip2location.com
|
63
63
|
licenses:
|
64
64
|
- Apache License (2.0)
|