logstash-filter-elastic_integration 0.0.3-java → 0.1.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb +90 -0
- data/lib/logstash/filters/elastic_integration/jar_dependencies.rb +1 -1
- data/lib/logstash/filters/elastic_integration.rb +2 -8
- data/vendor/jar-dependencies/co/elastic/logstash/plugins/filter/elasticintegration/logstash-filter-elastic_integration/{0.0.3/logstash-filter-elastic_integration-0.0.3.jar → 0.1.2/logstash-filter-elastic_integration-0.1.2.jar} +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810bf846f090f5104f4e60486a707e455552acd7d42ecfcfe8ba9cfc7e02c12c
|
4
|
+
data.tar.gz: 9800f2057e7639313ab87f09a65e200184e62eab43dbf16e35570662c3b85606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513bd99ae64f0f4627023d5c82c54e07661bcd57fe7fc560adfca381d5df62007dc40a9a55971eb50c76cc31cb33b2c820ec20a58f15ab86abd2ae579554a367
|
7
|
+
data.tar.gz: e0ec7b30280616024401652f0e33575363f70a695127304b63260ef2217952f6ead33b57e986f68f36fdab19121d4b909204f531b26a0deeae7c4fe62bc02c51
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.2
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V.
|
5
|
+
# under one or more contributor license agreements. Licensed under the
|
6
|
+
# Elastic License 2.0; you may not use this file except in compliance
|
7
|
+
# with the Elastic License 2.0.
|
8
|
+
########################################################################
|
9
|
+
|
10
|
+
require_relative "jar_dependencies"
|
11
|
+
|
12
|
+
##
|
13
|
+
# This module encapsulates methods and classes for bridging the gap between the
|
14
|
+
# Ruby-API [LogStash::GeoipDatabaseManager] and this plugin's native-Java
|
15
|
+
# GeoipDatabaseProvider.
|
16
|
+
module LogStash::Filters::ElasticIntegration::GeoipDatabaseProviderBridge
|
17
|
+
|
18
|
+
GUIDANCE = "integrations that rely on the Geoip Processor will be unable to enrich events with geo data "\
|
19
|
+
"unless you either provide your own databases with `geoip_database_directory` or run this pipeline "\
|
20
|
+
"in a Logstash with Geoip Database Management enabled."
|
21
|
+
|
22
|
+
def initialize_geoip_database_provider!
|
23
|
+
java_import('co.elastic.logstash.filters.elasticintegration.geoip.GeoIpDatabaseProvider')
|
24
|
+
@geoip_database_provider ||= GeoIpDatabaseProvider::Builder.new.tap do |builder|
|
25
|
+
if geoip_database_directory
|
26
|
+
logger.debug("discovering geoip databases from #{geoip_database_directory}")
|
27
|
+
builder.discoverDatabases(java.io.File.new(geoip_database_directory))
|
28
|
+
else
|
29
|
+
geoip_database_manager = load_geoip_database_manager!
|
30
|
+
if :UNAVAILABLE == geoip_database_manager
|
31
|
+
logger.warn("Geoip Database Management is not available in the running version of Logstash; #{GUIDANCE}")
|
32
|
+
elsif geoip_database_manager.enabled?
|
33
|
+
logger.info "by not manually configuring self-managed databases with `geoip_database_directory => ...` "\
|
34
|
+
"you accept and agree to the MaxMind EULA, which allows Elastic Integrations to use Logstash's Geoip Database Management service. "\
|
35
|
+
"For more details please visit https://www.maxmind.com/en/geolite2/eula"
|
36
|
+
|
37
|
+
geoip_database_manager.supported_database_types.each do |type|
|
38
|
+
logger.debug("subscribing to managed geoip database #{type}")
|
39
|
+
builder.setDatabaseHolder("GeoLite2-#{type}.mmdb", ObservingDatabaseHolder.new(type, eula_manager: geoip_database_manager, logger: logger))
|
40
|
+
end
|
41
|
+
elsif geoip_database_directory.nil?
|
42
|
+
logger.warn("Geoip Database Management is disabled; #{GUIDANCE}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end.build
|
46
|
+
end
|
47
|
+
|
48
|
+
def load_geoip_database_manager!
|
49
|
+
require 'geoip_database_management/manager'
|
50
|
+
|
51
|
+
LogStash::GeoipDatabaseManagement::Manager.instance
|
52
|
+
rescue LoadError
|
53
|
+
:UNAVAILABLE
|
54
|
+
end
|
55
|
+
|
56
|
+
java_import('co.elastic.logstash.filters.elasticintegration.geoip.ManagedGeoipDatabaseHolder')
|
57
|
+
class ObservingDatabaseHolder < ManagedGeoipDatabaseHolder
|
58
|
+
def initialize(simple_database_type, eula_manager:, logger: nil)
|
59
|
+
super("GeoLite2-#{simple_database_type}")
|
60
|
+
|
61
|
+
@simple_database_type = simple_database_type
|
62
|
+
@logger = logger
|
63
|
+
|
64
|
+
@subscription = eula_manager.subscribe_database_path(simple_database_type)
|
65
|
+
@subscription.observe(self)
|
66
|
+
end
|
67
|
+
|
68
|
+
def construct(db_info)
|
69
|
+
@logger&.debug("CONSTRUCT[#{@simple_database_type} => #{db_info}]")
|
70
|
+
self.setDatabasePath(db_info.path)
|
71
|
+
end
|
72
|
+
|
73
|
+
def on_update(db_info)
|
74
|
+
@logger&.debug("ON_UPDATE[#{@simple_database_type} => #{db_info}]")
|
75
|
+
self.setDatabasePath(db_info.path)
|
76
|
+
end
|
77
|
+
|
78
|
+
def on_expire()
|
79
|
+
@logger&.debug("ON_EXPIRE[#{@simple_database_type}]")
|
80
|
+
self.setDatabasePath(nil)
|
81
|
+
end
|
82
|
+
|
83
|
+
def close
|
84
|
+
super
|
85
|
+
ensure
|
86
|
+
@subscription&.release!
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
@@ -8,4 +8,4 @@
|
|
8
8
|
########################################################################
|
9
9
|
|
10
10
|
require 'jar_dependencies'
|
11
|
-
require_jar('co.elastic.logstash.plugins.filter.elasticintegration', 'logstash-filter-elastic_integration', '0.
|
11
|
+
require_jar('co.elastic.logstash.plugins.filter.elasticintegration', 'logstash-filter-elastic_integration', '0.1.2')
|
@@ -106,8 +106,10 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
|
|
106
106
|
|
107
107
|
require_relative "elastic_integration/jar_dependencies"
|
108
108
|
require_relative "elastic_integration/event_api_bridge"
|
109
|
+
require_relative "elastic_integration/geoip_database_provider_bridge"
|
109
110
|
|
110
111
|
extend EventApiBridge
|
112
|
+
extend GeoipDatabaseProviderBridge
|
111
113
|
|
112
114
|
super
|
113
115
|
|
@@ -365,14 +367,6 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
|
|
365
367
|
raise_config_error!("configuration did not produce an EventProcessor: #{exception}")
|
366
368
|
end
|
367
369
|
|
368
|
-
def initialize_geoip_database_provider!
|
369
|
-
java_import('co.elastic.logstash.filters.elasticintegration.geoip.GeoIpDatabaseProvider')
|
370
|
-
|
371
|
-
@geoip_database_provider ||= GeoIpDatabaseProvider::Builder.new.tap do |builder|
|
372
|
-
builder.setDatabases(java.io.File.new(@geoip_database_directory)) if @geoip_database_directory
|
373
|
-
end.build
|
374
|
-
end
|
375
|
-
|
376
370
|
def perform_preflight_check!
|
377
371
|
java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
|
378
372
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-elastic_integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,9 +71,10 @@ files:
|
|
71
71
|
- VERSION
|
72
72
|
- lib/logstash/filters/elastic_integration.rb
|
73
73
|
- lib/logstash/filters/elastic_integration/event_api_bridge.rb
|
74
|
+
- lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb
|
74
75
|
- lib/logstash/filters/elastic_integration/jar_dependencies.rb
|
75
76
|
- logstash-filter-elastic_integration.gemspec
|
76
|
-
- vendor/jar-dependencies/co/elastic/logstash/plugins/filter/elasticintegration/logstash-filter-elastic_integration/0.
|
77
|
+
- vendor/jar-dependencies/co/elastic/logstash/plugins/filter/elasticintegration/logstash-filter-elastic_integration/0.1.2/logstash-filter-elastic_integration-0.1.2.jar
|
77
78
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
78
79
|
licenses:
|
79
80
|
- ELv2
|