logstash-filter-ip2location 2.2.0 → 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: 12b3d47f6f2e9135045de37e9f2e47b9397e26bb27685dba85978d4ff482afa3
4
- data.tar.gz: b5be99d846f5902ec29d16f014398e8ee6d2496b8c312b9825c6eba99e63ab83
3
+ metadata.gz: a8c7b8743669d98650fc8d4127e79c3928ed9cd08e53ebc99abe83c558ac3c58
4
+ data.tar.gz: aa45ac59325576bd3b795899ab3fea4fe0f0df94f1b27795bedcf47d613e5d1f
5
5
  SHA512:
6
- metadata.gz: 9ed42549053efc5262b0c2bbc1b6b5b8968870ae3bf93a631e95be9aea88db0d7d1eb78dd67bb10bd09ccfc925a6b3584e1f382ba6b58f4deb5911061a5d0324
7
- data.tar.gz: 4fa2f3e95bcda442879df356ede8be54aaac2cd05d46c46ede2d04793ae17dd324b2cd266194a3db4250f604c6b5880eb593c11c8d77574420e9e2b8eba2e550
6
+ metadata.gz: cb72ff92c07aac310f3eba6dbad4eeb87d693213ec38e8b2583b879984c8eeab5b30eb377fc6fc29f8857eaeaa0ac9485341c7b23c40f32c84c11aedf106489b
7
+ data.tar.gz: 50138ca65b141cd41c02e979343dac669af1b8b3ebe55d208a1def01cbea4b4970d8f03a0baae92e3178f777fa8f825bc52c137a77794fecd13a2409885a14a0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 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
@@ -81,10 +81,14 @@ 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
@@ -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.6.0')
3
- require_jar('org.logstash.filters', 'logstash-filter-ip2location', '2.2.0')
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.2.0'
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.2.0
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: 2021-09-07 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.6.0/ip2location-8.6.0.jar
61
- - vendor/jar-dependencies/org/logstash/filters/logstash-filter-ip2location/2.2.0/logstash-filter-ip2location-2.2.0.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)