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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6092b06bf0222a42d8d7d0f69fc5c993d32445a05788b01641c2ecfdf91d4a4d
4
- data.tar.gz: 1c3ff2276bfd7bb9e7b8e10be986b4a83c2ede01292a9283ee76ee985e7977ca
3
+ metadata.gz: 5917b2904fe12390b69978d2975726352f40a0aea4ed70649caf4856da37616c
4
+ data.tar.gz: '086d0597aaaf1bfd9506a3167776c7fc5645cf018de52a25fb68dcd5b7b49249'
5
5
  SHA512:
6
- metadata.gz: 548f85a563528773b819bd4d12bdb5fcea378dc9368bd67a3f93e1589cc0b46c4721b07a40120a042936a13732ab2c8e4ba8087c1abeabafb2eab62480f64f8e
7
- data.tar.gz: 02cb99e4f03d015ce8c6706af01cedd4c3ba651f5e37e28548891f3214347e2fc1d95137256ee895ca6e82a36a24935d0d7f01942759991fcd6371c8799b836a
6
+ metadata.gz: 9651d9ebc865ae6afbd0741796e03a34fc7b1f2b38ada5dd3b4a1bfd8d3d72fd54ccd8a3319346a88916eb988a48afbd916527afe54afa170d943ea47b51848d
7
+ data.tar.gz: 3175868e1538e7135a256896ec0050555d922993dba58f80dde856a3c5badd58a00771339585917c43d227ad1c721c1fef5b1307eead32f6b7ae23dc6da9a71e
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,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, 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
 
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 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.4')
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'
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."
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
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: 2020-12-04 00:00:00.000000000 Z
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.3.0/ip2location-8.3.0.jar
61
- - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.1.4/logstash-filter-ip2location-2.1.4.jar
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
- rubyforge_project:
85
- rubygems_version: 2.7.6.2
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: