logstash-filter-elastic_integration 0.1.4-java → 0.1.6-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: dc62139a23aa300f55f6b999e10f879964255c073a970a4bd9270f12fb10f1cd
4
- data.tar.gz: 55e373e0f1dcd5b51bc71947f9e2c819918b6ccdecbbdea5fcd3d0c8690ee800
3
+ metadata.gz: 42064e629d840e1dde24f44a4ec639e5afd3b1a371933e566324b9ccee02b5fd
4
+ data.tar.gz: 152eb97750aaff4203adb509d5b2bd603f122f587ac47f6e34830ac9d6850b32
5
5
  SHA512:
6
- metadata.gz: 710c901f9047b62c5622590471d3d5659f7491a4733c59d8ca4b3605abce6a5778439b1c361b9d0e575204bd3ee7b9c3e69da14384223d0c3d66e1b248a64b64
7
- data.tar.gz: b392b6cda55d16313dd9aeb62a69c3b03c7c845e3df8ebae8785079b67da1162746ddcc2358fc61101dd9a8080e3d6d0d35f4001baa682c1338876ba25d1adf0
6
+ metadata.gz: 7a130149b460b772bac9038862ad57527df69d7b91d849b16c443f31da0e19a74b139ae96554b3da34b3385179468252ada90ace1c3301d3ef83b371db9ae166
7
+ data.tar.gz: 420425f9ba131bbc5206fe429c629265cdc73871a4bdb2c75fa71c61679bbb8b5ee38b468420c5b82efb1cf65120cb36555d0aab617192abbbe09e6fa1269d52
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.6
@@ -8,4 +8,4 @@
8
8
  ########################################################################
9
9
 
10
10
  require 'jar_dependencies'
11
- require_jar('co/elastic', 'logstash-filter-elastic_integration', '0.1.4')
11
+ require_jar('co/elastic', 'logstash-filter-elastic_integration', '0.1.6')
@@ -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.6'
@@ -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.4
4
+ version: 0.1.6
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-25 00:00:00.000000000 Z
11
+ date: 2024-02-08 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-filter-elastic_integration/0.1.4/logstash-filter-elastic_integration-0.1.4.jar
78
+ - vendor/jar-dependencies/co/elastic/logstash-filter-elastic_integration/0.1.6/logstash-filter-elastic_integration-0.1.6.jar
78
79
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
79
80
  licenses:
80
81
  - ELv2