logstash-filter-elastic_integration 0.1.3-java → 0.1.5-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21430d0dc0a98cf6eadc3506b166ef28713b76057ab45596f7719dc42b0a1db6
4
- data.tar.gz: a90a57659855a7974e6bc59febbe79c33956bbd17c510d00d03598c296e441fb
3
+ metadata.gz: 9db076bb6985c6d16b373849fda75131b07b47be67a1fdf60df0a09241c09547
4
+ data.tar.gz: 8da7403123c739e0ca0a69c1b2e3886edbd8f4e92fcce09f06b1f3f416e42903
5
5
  SHA512:
6
- metadata.gz: 87d72010a17fe6e4ef6424c0eec2de9abb71674dac5ae4084a1192de117ae2a5bcf7b02adde7dc0b5401befc5b2ecabb4bcbe0e59c78b9093e20839bd8ec1cbd
7
- data.tar.gz: 1d62d9527b95f4a51a32617781a8655461ad399e6c59ab5d5bc58afc1bf62aa86ba98aaa1811379aeff1b8b3a03fe01e9f6eef0d817f071ca418fffed6c3df18
6
+ metadata.gz: 1fdf95f7a102886ae6a7d063a3522077d60e1f7474060d6cf451e7206256e4a1f29737d663f5e734309c334f59a93b863ad016cb7424986a117c41dc3a3ff7c2
7
+ data.tar.gz: 3412852bd919051ec1e73486b960ea99da4fde1d75d0d2de036a162efba477d6088b8ee27d9260253658c3b0bd52ccf4fc7103fdc53291a6e3033526d4520601
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.5
@@ -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.1.3')
11
+ require_jar('co/elastic', 'logstash-filter-elastic_integration', '0.1.5')
@@ -0,0 +1,10 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
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
+ LogStash::Filters::ElasticIntegration::VERSION='0.1.5'
@@ -20,6 +20,9 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
20
20
  HTTPS_PROTOCOL = "https".freeze
21
21
  ELASTIC_API_VERSION = "2023-10-31".freeze
22
22
 
23
+ require_relative "elastic_integration/version"
24
+ USER_AGENT_HEADER_VALUE = "Logstash/v#{LOGSTASH_VERSION} (ElasticIntegration/v#{VERSION})"
25
+
23
26
  # Sets the host(s) of the remote instance. If given an array it will load balance
24
27
  # requests across the hosts specified in the `hosts` parameter. Hosts can be any of
25
28
  # the forms:
@@ -337,24 +340,27 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
337
340
  end
338
341
 
339
342
  def initialize_elasticsearch_rest_client!
340
- java_import('co.elastic.logstash.filters.elasticintegration.ElasticsearchRestClientBuilder')
341
- java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
342
-
343
343
  config = extract_immutable_config
344
- @elasticsearch_rest_client = ElasticsearchRestClientBuilder.fromPluginConfiguration(config)
345
- .map(&:build)
346
- .orElseThrow() # todo: ruby/java bridge better exception
344
+ @elasticsearch_rest_client = _elasticsearch_rest_client(config)
347
345
 
348
346
  if serverless?
349
- @elasticsearch_rest_client = ElasticsearchRestClientBuilder.fromPluginConfiguration(config)
350
- .map do |builder|
351
- builder.configureElasticApi { |elasticApi| elasticApi.setApiVersion(ELASTIC_API_VERSION) }
352
- end
353
- .map(&:build)
354
- .orElseThrow()
347
+ @elasticsearch_rest_client = _elasticsearch_rest_client(config) do |builder|
348
+ builder.configureElasticApi { |elasticApi| elasticApi.setApiVersion(ELASTIC_API_VERSION) }
349
+ end
355
350
  end
356
351
  end
357
352
 
353
+ def _elasticsearch_rest_client(config, &builder_interceptor)
354
+ java_import('co.elastic.logstash.filters.elasticintegration.ElasticsearchRestClientBuilder')
355
+ java_import('java.util.function.Function')
356
+
357
+ ElasticsearchRestClientBuilder.fromPluginConfiguration(config)
358
+ .map { |builder| builder.setUserAgentHeaderValue(USER_AGENT_HEADER_VALUE) }
359
+ .map(&(builder_interceptor || Function::identity.method(:apply)))
360
+ .map(&:build)
361
+ .orElseThrow() # todo: ruby/java bridge better exception
362
+ end
363
+
358
364
  def initialize_event_processor!
359
365
  java_import('co.elastic.logstash.filters.elasticintegration.EventProcessorBuilder')
360
366
  java_import('co.elastic.logstash.filters.elasticintegration.geoip.GeoIpProcessorFactory')
@@ -368,13 +374,12 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
368
374
  end
369
375
 
370
376
  def perform_preflight_check!
371
- java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
372
-
373
377
  check_user_privileges!
374
378
  check_es_cluster_license!
375
379
  end
376
380
 
377
381
  def check_user_privileges!
382
+ java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
378
383
  PreflightCheck.new(@elasticsearch_rest_client).checkUserPrivileges
379
384
  rescue => e
380
385
  security_error_message = "no handler found for uri [/_security/user/_has_privileges]"
@@ -398,12 +403,14 @@ class LogStash::Filters::ElasticIntegration < LogStash::Filters::Base
398
403
  end
399
404
 
400
405
  def check_es_cluster_license!
406
+ java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
401
407
  PreflightCheck.new(@elasticsearch_rest_client).checkLicense
402
408
  rescue => e
403
409
  raise_config_error!(e.message)
404
410
  end
405
411
 
406
412
  def serverless?
413
+ java_import('co.elastic.logstash.filters.elasticintegration.PreflightCheck')
407
414
  PreflightCheck.new(@elasticsearch_rest_client).isServerless
408
415
  rescue => e
409
416
  raise_config_error!(e.message)
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.1.3
4
+ version: 0.1.5
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2024-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -73,8 +73,9 @@ files:
73
73
  - lib/logstash/filters/elastic_integration/event_api_bridge.rb
74
74
  - lib/logstash/filters/elastic_integration/geoip_database_provider_bridge.rb
75
75
  - lib/logstash/filters/elastic_integration/jar_dependencies.rb
76
+ - lib/logstash/filters/elastic_integration/version.rb
76
77
  - logstash-filter-elastic_integration.gemspec
77
- - vendor/jar-dependencies/co/elastic/logstash/plugins/filter/elasticintegration/logstash-filter-elastic_integration/0.1.3/logstash-filter-elastic_integration-0.1.3.jar
78
+ - vendor/jar-dependencies/co/elastic/logstash-filter-elastic_integration/0.1.5/logstash-filter-elastic_integration-0.1.5.jar
78
79
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
79
80
  licenses:
80
81
  - ELv2