logstash-filter-geoip 7.1.0-java → 7.1.1-java

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: d3997f6af427481c6a4b2831a3253a98609c0105054182fd32ad7a1815497072
4
- data.tar.gz: 6e9ba6c58d7ccfa8049a8702018422441e003607633072ad6359c700b8dce8ed
3
+ metadata.gz: a8f972c83ce35472fe5a892d06feb1456a9ff072fb6d7807c506b2d2ea315450
4
+ data.tar.gz: 91b5177cb892abadb65dfb17eaea8ee662fde6e9a7ed9117a8e5313fe24cb6e0
5
5
  SHA512:
6
- metadata.gz: 44d7f9debe16a4245b7044b4dba632d1478f5216852b5ae0d2a919e797dce0d06c080a27bf82c081295819a84fd86dd3931ddc626a344624529c9255ac3dc645
7
- data.tar.gz: 929c2867ab360f704123daac8536ec1f5775bd0081ba797bf563111a9ac40729f94b269e026e2f11d8367e7f3d59f446868f57ace6ddee34cb992fc5420de786
6
+ metadata.gz: 1bb793fafd708598ed64de4b6131bd527e5a6d7b61d4e997f025c4e251158bcabc163dd41250202957617bd0bab6e6084c5b209a823af7cd8d8e2380c0aa269d
7
+ data.tar.gz: a44e5bab8b0157621a274437336af8eb90dc2565047fcd2076ef0933b76b1482c0aa441164a67651f874331651bfef548fd6a554fcf6e82930bfc9accb7cf2bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 7.1.1
2
+ - Changed the behaviour of database expiry. Instead of stopping the pipeline, it adds a tag `_geoip_expired_database` [#182](https://github.com/logstash-plugins/logstash-filter-geoip/pull/182)
3
+
1
4
  ## 7.1.0
2
5
  - Add ECS compatibility [#179](https://github.com/logstash-plugins/logstash-filter-geoip/pull/179)
3
6
 
@@ -112,6 +112,8 @@ class LogStash::Filters::GeoIP < LogStash::Filters::Base
112
112
  public
113
113
  def filter(event)
114
114
  return unless filter?(event)
115
+ return event.tag("_geoip_expired_database") unless @healthy_database
116
+
115
117
  if @geoipfilter.handleEvent(event)
116
118
  filter_matched(event)
117
119
  else
@@ -144,11 +146,23 @@ class LogStash::Filters::GeoIP < LogStash::Filters::Base
144
146
 
145
147
 
146
148
  def setup_filter(database_path)
149
+ @healthy_database = true
147
150
  @database = database_path
148
- @logger.info("Using geoip database", :path => @database)
151
+ @logger.info("Using geoip database", :path => @database, :healthy_database => @healthy_database)
149
152
  @geoipfilter = org.logstash.filters.geoip.GeoIPFilter.new(@source, @target, @fields, @database, @cache_size, ecs_compatibility.to_s)
150
153
  end
151
154
 
155
+ # call by DatabaseManager
156
+ def expire_action
157
+ fail_filter
158
+ end
159
+
160
+ def fail_filter
161
+ @healthy_database = false
162
+ @logger.warn("geoip plugin will stop filtering and will tag all events with the '_geoip_expired_database' tag.",
163
+ :healthy_database => @healthy_database)
164
+ end
165
+
152
166
  def terminate_filter
153
167
  @logger.info("geoip plugin is terminating")
154
168
  pipeline_id = execution_context.pipeline_id
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-geoip'
4
- s.version = '7.1.0'
4
+ s.version = '7.1.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Adds geographical information about an IP address"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -1,12 +1,16 @@
1
1
  require "logstash-core/logstash-core"
2
2
  require "digest"
3
3
 
4
- def get_vendor_path
5
- ::File.expand_path("../../vendor/", ::File.dirname(__FILE__))
4
+ def get_vendor_path(filename)
5
+ ::File.join(::File.expand_path("../../vendor/", ::File.dirname(__FILE__)), filename)
6
+ end
7
+
8
+ def get_data_dir
9
+ ::File.join(LogStash::SETTINGS.get_value("path.data"), "plugins", "filters", "geoip")
6
10
  end
7
11
 
8
12
  def get_file_path(filename)
9
- ::File.join(get_vendor_path, filename)
13
+ ::File.join(get_data_dir, filename)
10
14
  end
11
15
 
12
16
  def get_metadata_database_name
@@ -14,8 +18,8 @@ def get_metadata_database_name
14
18
  end
15
19
 
16
20
  METADATA_PATH = get_file_path("metadata.csv")
17
- DEFAULT_CITY_DB_PATH = get_file_path("GeoLite2-City.mmdb")
18
- DEFAULT_ASN_DB_PATH = get_file_path("GeoLite2-ASN.mmdb")
21
+ DEFAULT_CITY_DB_PATH = get_vendor_path("GeoLite2-City.mmdb")
22
+ DEFAULT_ASN_DB_PATH = get_vendor_path("GeoLite2-ASN.mmdb")
19
23
 
20
24
  major, minor = LOGSTASH_VERSION.split(".")
21
25
  MAJOR = major.to_i
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-geoip
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2021-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement