logstash-filter-ip2location 2.1.4 → 2.3.1
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 +9 -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.9.1/ip2location-8.9.1.jar +0 -0
- data/vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.3.1/logstash-filter-ip2location-2.3.1.jar +0 -0
- metadata +8 -9
- 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.4/logstash-filter-ip2location-2.1.4.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: 5917b2904fe12390b69978d2975726352f40a0aea4ed70649caf4856da37616c
|
4
|
+
data.tar.gz: '086d0597aaaf1bfd9506a3167776c7fc5645cf018de52a25fb68dcd5b7b49249'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9651d9ebc865ae6afbd0741796e03a34fc7b1f2b38ada5dd3b4a1bfd8d3d72fd54ccd8a3319346a88916eb988a48afbd916527afe54afa170d943ea47b51848d
|
7
|
+
data.tar.gz: 3175868e1538e7135a256896ec0050555d922993dba58f80dde856a3c5badd58a00771339585917c43d227ad1c721c1fef5b1307eead32f6b7ae23dc6da9a71e
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
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
|
|
6
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
7
|
|
8
|
+
*Note: This plugin works in Logstash 7 and Logstash 8.*
|
9
|
+
|
8
10
|
|
9
11
|
## Dependencies (IP2LOCATION BIN DATA FILE)
|
10
12
|
This plugin requires IP2Location BIN data file to function. You may download the BIN data file at
|
@@ -81,16 +83,22 @@ output {
|
|
81
83
|
|source|string|Yes|
|
82
84
|
|database|a valid filesystem path|No|
|
83
85
|
|use_memory_mapped|boolean|No|
|
86
|
+
|use_cache|boolean|No|
|
87
|
+
|hide_unsupported_fields|boolean|No|
|
84
88
|
|
85
89
|
* **source** field is a required setting that containing the IP address or hostname to get the ip information.
|
86
90
|
* **database** field is an optional setting that containing the path to the IP2Location BIN database file.
|
87
91
|
* **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.
|
92
|
+
* **use_cache** field is an optional setting that used to allow user to enable the use of cache. Default value is true.
|
93
|
+
* **hide_unsupported_fields** field is an optional setting that used to allow user to hide unsupported fields. Default value is false.
|
88
94
|
|
89
95
|
|
90
96
|
## Sample Output
|
91
97
|
|Field|Description|
|
92
98
|
|---|---|
|
99
|
+
|ip2location.address_type|the IP address type (A-Anycast, B-Broadcast, M-Multicast & U-Unicast) of IP address or domain name|
|
93
100
|
|ip2location.area_code|the varying length number assigned to geographic areas for call between cities|
|
101
|
+
|ip2location.category|the IAB content taxonomy category of IP address or domain name|
|
94
102
|
|ip2location.city|the city name|
|
95
103
|
|ip2location.country_long|the country name based on ISO 3166|
|
96
104
|
|ip2location.country_short|the two-character country code based on ISO 3166|
|
@@ -113,8 +121,6 @@ output {
|
|
113
121
|
|ip2location.weather_station_name|the name of the nearest weather observation station|
|
114
122
|
|ip2location.zip_code|the ZIP code|
|
115
123
|
|
116
|
-
![Example of data](https://www.ip2location.com/assets/img/logstash-filter-ip2location-screenshot2.png)
|
117
|
-
|
118
124
|
|
119
125
|
## Support
|
120
126
|
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.1
|
2
|
+
require_jar('com.ip2location.ip2location', 'ip2location', '8.9.1')
|
3
|
+
require_jar('org.logstash.filters', 'logstash-filter-ip2location', '2.3.1')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-ip2location'
|
4
|
-
s.version = '2.1
|
4
|
+
s.version = '2.3.1'
|
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.9.1/ip2location-8.9.1.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.1
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IP2Location
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|
@@ -57,15 +57,15 @@ 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.1
|
60
|
+
- vendor/jar-dependencies/com/ip2location/ip2location/ip2location/8.9.1/ip2location-8.9.1.jar
|
61
|
+
- vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.3.1/logstash-filter-ip2location-2.3.1.jar
|
62
62
|
homepage: https://www.ip2location.com
|
63
63
|
licenses:
|
64
64
|
- Apache License (2.0)
|
65
65
|
metadata:
|
66
66
|
logstash_plugin: 'true'
|
67
67
|
logstash_group: filter
|
68
|
-
post_install_message:
|
68
|
+
post_install_message:
|
69
69
|
rdoc_options: []
|
70
70
|
require_paths:
|
71
71
|
- lib
|
@@ -81,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
85
|
-
|
86
|
-
signing_key:
|
84
|
+
rubygems_version: 3.2.33
|
85
|
+
signing_key:
|
87
86
|
specification_version: 4
|
88
87
|
summary: Logstash filter IP2Location
|
89
88
|
test_files:
|