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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66bf5b322ca6ee557f4e4963f2b5852b9d1431bc8c352c87399086856351c0fc
4
- data.tar.gz: 148e265f72358675a6cb8fa98fed9524720bb9e95eb4140625d9ebd57c6cc804
3
+ metadata.gz: a8c7b8743669d98650fc8d4127e79c3928ed9cd08e53ebc99abe83c558ac3c58
4
+ data.tar.gz: aa45ac59325576bd3b795899ab3fea4fe0f0df94f1b27795bedcf47d613e5d1f
5
5
  SHA512:
6
- metadata.gz: 69ce57d18fa700af31cac13a96882727b9ecef552b0156ddcb983648f5f3fbdac28c40708de6a5955b4ebb45cad97289c770474724c1ebcbf0c01b635c507a4b
7
- data.tar.gz: 4a29b7796e90acdca675163d01897bb5cca61c679395114225bdcc8e48e780aeadfd9421eae02c9b9eb044c681e0eb2bbd415af49e9e6fa7fcd2b7d5245a685b
6
+ metadata.gz: cb72ff92c07aac310f3eba6dbad4eeb87d693213ec38e8b2583b879984c8eeab5b30eb377fc6fc29f8857eaeaa0ac9485341c7b23c40f32c84c11aedf106489b
7
+ data.tar.gz: 50138ca65b141cd41c02e979343dac669af1b8b3ebe55d208a1def01cbea4b4970d8f03a0baae92e3178f777fa8f825bc52c137a77794fecd13a2409885a14a0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 IP2Location.com
1
+ Copyright (c) 2022 IP2Location.com
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
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, and usage type by IP address. The library reads the geo location information from **IP2Location BIN data** file.
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 value = Cache.find(event, ip, @ip2locationfilter, @cache_size).get('ip2location')
51
- event.set('ip2location', value)
52
- filter_matched(event)
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
- tag_iplookup_unsuccessful(event)
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.0')
3
- require_jar('org.logstash.filters', 'logstash-filter-ip2location', '2.1.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.1.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."
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.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: 2020-07-20 00:00:00.000000000 Z
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.3.0/ip2location-8.3.0.jar
61
- - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.1.2/logstash-filter-ip2location-2.1.2.jar
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)