Module: LogStash::Filters::ElasticIntegration::GeoipDatabaseProviderBridge
- Defined in:
- lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb
Overview
This module encapsulates methods and classes for bridging the gap between the Ruby-API [LogStash::GeoipDatabaseManager] and this plugin’s native-Java GeoipDatabaseProvider.
Defined Under Namespace
Classes: ObservingDatabaseHolder
Constant Summary collapse
- GUIDANCE =
"integrations that rely on the Geoip Processor will be unable to enrich events with geo data "\ "unless you either provide your own databases with `geoip_database_directory` or run this pipeline "\ "in a Logstash with Geoip Database Management enabled."
Instance Method Summary collapse
Instance Method Details
#initialize_geoip_database_provider! ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 22 def initialize_geoip_database_provider! java_import('co.elastic.logstash.filters.elasticintegration.geoip.IpDatabaseProvider') @geoip_database_provider ||= IpDatabaseProvider::Builder.new.tap do |builder| if geoip_database_directory logger.debug("discovering geoip databases from #{geoip_database_directory}") builder.discoverDatabases(java.io.File.new(geoip_database_directory)) else geoip_database_manager = load_geoip_database_manager! if :UNAVAILABLE == geoip_database_manager logger.warn("Geoip Database Management is not available in the running version of Logstash; #{GUIDANCE}") elsif geoip_database_manager.enabled? logger.info "by not manually configuring self-managed databases with `geoip_database_directory => ...` "\ "you accept and agree to the MaxMind EULA, which allows Elastic Integrations to use Logstash's Geoip Database Management service. "\ "For more details please visit https://www.maxmind.com/en/geolite2/eula" geoip_database_manager.supported_database_types.each do |type| logger.debug("subscribing to managed geoip database #{type}") builder.setDatabaseHolder("GeoLite2-#{type}.mmdb", ObservingDatabaseHolder.new(type, eula_manager: geoip_database_manager, logger: logger)) end elsif geoip_database_directory.nil? logger.warn("Geoip Database Management is disabled; #{GUIDANCE}") end end end.build end |
#load_geoip_database_manager! ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb', line 48 def load_geoip_database_manager! require 'geoip_database_management/manager' LogStash::GeoipDatabaseManagement::Manager.instance rescue LoadError :UNAVAILABLE end |