fluent-plugin-oci-logging-analytics 2.0.7 → 2.1.0

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: 5b41804c02cd5e1dd39efc4c600f043cbed2a90972aabc39671c830fedcafe67
4
- data.tar.gz: 24fc404d3f0f4d06f2e9f2167d7bc4fff337a235f9671e7e024ce71763750cb8
3
+ metadata.gz: fd5776c0bd11f46ba2366daaef22deeae726369f8f96071de570bb49ae6518bc
4
+ data.tar.gz: cd579f95bb5ca0fb80eaac9545f2b4658fed580dff45e3d6d7daa7fdb004eb94
5
5
  SHA512:
6
- metadata.gz: a779a1971cabf78edf2c0b14ae6ba06235ce4113fe0ded3b264d626baba6c7f82f3aabdcb029890cb52697b2b01ae119691c7412e7920c79ada71ce8ed060fff
7
- data.tar.gz: ef679bc249d8d16bc12a447f158c19faea8425c98170aecfbd7053da7d4081876f2b830f7c59dcef50e4abb9422d8e2cac30e91c16bffc4cf8e33072f931fe9c
6
+ metadata.gz: 3faf9d1372e1da861d7b3f5e32dc82b401379ffece838003cf5862ea380c52d6ed3d13b053470dc11bdbba18382fed71699188a832bf002635854c9f7ef47297
7
+ data.tar.gz: ba6c3e00de0cdf9843fc965249a1db4896b5a36632b5b6fa4a998f191ecd8247e9690aff5cde5379cb532418e94370ae8c4146f57c395d7435839b7f774cd28f
@@ -21,5 +21,4 @@ class LogEvents
21
21
  timezone:@timezone
22
22
  }.compact
23
23
  end
24
-
25
24
  end
@@ -20,5 +20,4 @@ class LogEventsJson
20
20
  end
21
21
  }.compact
22
22
  end
23
-
24
23
  end
@@ -17,15 +17,15 @@ class PrometheusMetrics
17
17
  end
18
18
  def createMetrics
19
19
  gauge = Prometheus::Client::Gauge
20
- @records_received = gauge.new(:oci_la_fluentd_output_plugin_records_received, docstring: 'Number of records received by the OCI Logging Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
21
- @records_valid = gauge.new(:oci_la_fluentd_output_plugin_records_valid, docstring: 'Number of valid records received by the OCI Logging Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
22
- @records_invalid = gauge.new(:oci_la_fluentd_output_plugin_records_invalid, docstring: 'Number of invalid records received by the OCI Logging Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set,:reason])
23
- @records_error = gauge.new(:oci_la_fluentd_output_plugin_records_post_error, docstring: 'Number of records failed posting to OCI Logging Analytics by the Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set,:error_code, :reason])
24
- @records_posted = gauge.new(:oci_la_fluentd_output_plugin_records_post_success, docstring: 'Number of records posted by the OCI Logging Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
20
+ @records_received = gauge.new(:oci_la_fluentd_output_plugin_records_received, docstring: 'Number of records received by the OCI Log Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
21
+ @records_valid = gauge.new(:oci_la_fluentd_output_plugin_records_valid, docstring: 'Number of valid records received by the OCI Log Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
22
+ @records_invalid = gauge.new(:oci_la_fluentd_output_plugin_records_invalid, docstring: 'Number of invalid records received by the OCI Log Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set,:reason])
23
+ @records_error = gauge.new(:oci_la_fluentd_output_plugin_records_post_error, docstring: 'Number of records failed posting to OCI Log Analytics by the Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set,:error_code, :reason])
24
+ @records_posted = gauge.new(:oci_la_fluentd_output_plugin_records_post_success, docstring: 'Number of records posted by the OCI Log Analytics Fluentd output plugin.', labels: [:worker_id,:tag,:oci_la_log_group_id,:oci_la_log_source_name,:oci_la_log_set])
25
25
 
26
26
  histogram = Prometheus::Client::Histogram
27
- @chunk_time_to_receive = histogram.new(:oci_la_fluentd_output_plugin_chunk_time_to_receive, docstring: 'Average time taken by Fluentd to deliver the collected records from Input plugin to OCI Logging Analytics output plugin.', labels: [:worker_id,:tag])
28
- @chunk_time_to_upload = histogram.new(:oci_la_fluentd_output_plugin_chunk_time_to_post, docstring: 'Average time taken for posting the received records to OCI Logging Analytics by the Fluentd output plugin.', labels: [:worker_id,:oci_la_log_group_id])
27
+ @chunk_time_to_receive = histogram.new(:oci_la_fluentd_output_plugin_chunk_time_to_receive, docstring: 'Average time taken by Fluentd to deliver the collected records from Input plugin to OCI Log Analytics output plugin.', labels: [:worker_id,:tag])
28
+ @chunk_time_to_upload = histogram.new(:oci_la_fluentd_output_plugin_chunk_time_to_post, docstring: 'Average time taken for posting the received records to OCI Log Analytics by the Fluentd output plugin.', labels: [:worker_id,:oci_la_log_group_id])
29
29
  end
30
30
 
31
31
  def registerMetrics
@@ -92,6 +92,8 @@ module Fluent::Plugin
92
92
  config_param :endpoint, :string, :default => nil
93
93
  desc 'AuthType to be used.'
94
94
  config_param :auth_type, :string, :default => 'InstancePrincipal'
95
+ desc 'OCI Domain'
96
+ config_param :oci_domain, :string, :default => nil
95
97
  desc 'Enable local payload dump.'
96
98
  config_param :dump_zip_file, :bool, :default => false
97
99
  desc 'Payload zip File Location.'
@@ -241,7 +243,7 @@ module Fluent::Plugin
241
243
  rescue => ex
242
244
  @@logger = log
243
245
  @@logger.error {"Error while initializing logger:#{ex.inspect}"}
244
- @@logger.info {"Redirecting oci logging analytics logs to STDOUT"}
246
+ @@logger.info {"Redirecting oci log analytics logs to STDOUT"}
245
247
  end
246
248
  end
247
249
 
@@ -249,34 +251,91 @@ module Fluent::Plugin
249
251
  if is_valid(@config_file_location)
250
252
  @auth_type = "ConfigFile"
251
253
  end
254
+
252
255
  case @auth_type
253
- when "InstancePrincipal"
256
+ when "InstancePrincipal"
257
+ instance_principals_signer = nil
258
+ la_endpoint = nil
259
+ if is_valid(@oci_domain)
260
+ fedration_endpoint = "https://auth.#{@oci_domain}/v1/x509"
261
+ instance_principals_signer = OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new(
262
+ federation_endpoint: fedration_endpoint)
263
+ @@logger.info "Custom Federation Endpoint: #{fedration_endpoint}"
264
+ else
254
265
  instance_principals_signer = OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
255
- if is_valid(@endpoint)
256
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: OCI::Config.new, endpoint: @endpoint, signer: instance_principals_signer)
257
- @@logger.info {"loganalytics_client initialised with endpoint: #{@endpoint}"}
258
- else
259
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: OCI::Config.new, signer: instance_principals_signer)
260
- end
261
- when "WorkloadIdentity"
262
- workload_identity_signer = OCI::Auth::Signers::oke_workload_resource_principal_signer
263
- if is_valid(@endpoint)
264
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: OCI::Config.new, endpoint: @endpoint, signer: workload_identity_signer)
265
- @@logger.info {"loganalytics_client initialised with endpoint: #{@endpoint}"}
266
- else
267
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: OCI::Config.new, signer: workload_identity_signer)
268
- end
269
- when "ConfigFile"
270
- my_config = OCI::ConfigFileLoader.load_config(config_file_location: @config_file_location, profile_name: @profile_name)
271
- if is_valid(@endpoint)
272
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: my_config, endpoint: @endpoint)
273
- @@logger.info {"loganalytics_client initialised with endpoint: #{@endpoint}"}
274
- else
275
- @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config:my_config)
266
+ end
267
+ if is_valid(@endpoint)
268
+ la_endpoint = @endpoint
269
+ @@logger.info "Initializing loganalytics_client with endpoint: #{la_endpoint}"
270
+ elsif is_valid(@oci_domain)
271
+ la_endpoint = "https://loganalytics.#{@oci_domain}"
272
+ @@logger.info "Initializing loganalytics_client with custom domain endpoint: #{la_endpoint}"
273
+ end
274
+ @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(
275
+ config: OCI::Config.new,
276
+ endpoint: la_endpoint,
277
+ signer: instance_principals_signer)
278
+ @@logger.info 'loganalytics_client initialized.'
279
+ when "WorkloadIdentity"
280
+ workload_identity_signer = OCI::Auth::Signers.oke_workload_resource_principal_signer
281
+ region = nil
282
+ config = OCI::Config.new
283
+
284
+ if is_valid(@oci_domain)
285
+ region_match = @oci_domain.match(/^([^.]+)\.oci\./)
286
+ region = region_match[1]
287
+ @@logger.info "Extracted region from oci_domain: #{region}"
288
+ else
289
+ begin
290
+ tmp_signer = OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
291
+ if tmp_signer.region
292
+ region = tmp_signer.region
293
+ @@logger.info "Extracted region from IMDS: #{region}"
294
+ else
295
+ raise Fluent::ConfigError, "IMDS returned nil region. " \
296
+ "Please provide 'oci_domain' parameter (e.g., us-ashburn-1.oci.oraclecloud.com)."
297
+ end
298
+ rescue Fluent::ConfigError
299
+ raise
300
+ rescue => e
301
+ raise Fluent::ConfigError, "Unable to determine region. " \
302
+ "IMDS not available: #{e.message}. " \
303
+ "Please provide 'oci_domain' parameter (e.g., us-ashburn-1.oci.oraclecloud.com)."
276
304
  end
305
+ end
306
+ if is_valid(@endpoint)
307
+ la_endpoint = @endpoint
308
+ @@logger.info "Using custom endpoint"
309
+ elsif is_valid(@oci_domain)
310
+ la_endpoint = "https://loganalytics.#{@oci_domain}"
311
+ @@logger.info "Using oci_domain endpoint"
277
312
  else
278
- raise Fluent::ConfigError, "Invalid authType @auth_type, authType must be either InstancePrincipal or ConfigFile."
279
- abort
313
+ la_endpoint = nil
314
+ @@logger.info "Using SDK default endpoint"
315
+ end
316
+ config.region = region
317
+
318
+ @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(
319
+ config: config,
320
+ endpoint: la_endpoint,
321
+ signer: workload_identity_signer)
322
+ @@logger.info 'loganalytics_client initialized with WorkloadIdentity.'
323
+ when "ConfigFile"
324
+ my_config = OCI::ConfigFileLoader.load_config(
325
+ config_file_location: @config_file_location,
326
+ profile_name: @profile_name)
327
+ la_endpoint = nil
328
+ if is_valid(@endpoint)
329
+ la_endpoint = @endpoint
330
+ @@logger.info "Initializing loganalytics_client with endpoint: #{la_endpoint}"
331
+ elsif is_valid(@oci_domain)
332
+ la_endpoint = "https://loganalytics.#{@oci_domain}"
333
+ @@logger.info "Initializing loganalytics_client with custom domain endpoint: #{la_endpoint}"
334
+ end
335
+ @@loganalytics_client = OCI::LogAnalytics::LogAnalyticsClient.new(config: my_config, endpoint: la_endpoint)
336
+ @@logger.info 'loganalytics_client initialised'
337
+ else
338
+ raise Fluent::ConfigError, "Invalid authType: #{@auth_type}, valid inputs are - InstancePrincipal, ConfigFile, WorkloadIdentity"
280
339
  end
281
340
 
282
341
  if is_valid(@proxy_ip) && is_number(@proxy_port)
@@ -288,13 +347,19 @@ module Fluent::Plugin
288
347
  end
289
348
 
290
349
  rescue => ex
291
- @@logger.error {"Error occurred while initializing LogAnalytics Client:
292
- authType: #{@auth_type},
293
- errorMessage: #{ex}"}
350
+ @@logger.error {"Error occurred while initializing LogAnalytics Client:
351
+ authType: #{@auth_type},
352
+ errorMessage: #{ex}"}
294
353
  end
295
354
 
296
355
  def configure(conf)
297
356
  super
357
+
358
+ if is_valid(@oci_domain) && !@oci_domain.match(/^[a-z0-9-]+\.oci\.[a-z0-9.]+[a-z0-9]$/i)
359
+ raise Fluent::ConfigError, "Invalid oci_domain: #{@oci_domain}, " \
360
+ "valid format: <region>.oci.<domain> (e.g., us-ashburn-1.oci.oraclecloud.com)"
361
+ end
362
+
298
363
  @@prometheusMetrics = PrometheusMetrics.instance
299
364
  initialize_logger
300
365
 
@@ -1,8 +1,8 @@
1
- ## Copyright (c) 2024 Oracle and/or its affiliates.
1
+ ## Copyright (c) 2021, 2024 Oracle and/or its affiliates.
2
2
  ## The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
3
3
 
4
4
  # frozen_string_literal: true
5
5
 
6
6
  module Version
7
- VERSION = "2.0.7".freeze
7
+ VERSION = "2.1.0".freeze
8
8
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-oci-logging-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oracle
8
8
  - 'OCI Observability: Logging Analytics'
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-10-10 00:00:00.000000000 Z
12
+ date: 2026-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -121,8 +121,8 @@ dependencies:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: 1.4.3
124
- description: OCI Logging Analytics Fluentd output plugin for ingesting the collected
125
- log events to OCI Logging Analytics.
124
+ description: Fluentd output plugin for ingesting the collected log events to OCI Log
125
+ Analytics (previously known as OCI Logging Analytics).
126
126
  email:
127
127
  - oci_la_plugins_grp@oracle.com
128
128
  executables: []
@@ -136,14 +136,14 @@ files:
136
136
  - lib/fluent/metrics/prometheusMetrics.rb
137
137
  - lib/fluent/plugin/out_oci-logging-analytics.rb
138
138
  - lib/fluent/version/version.rb
139
- homepage:
139
+ homepage:
140
140
  licenses:
141
141
  - UPL-1.0
142
142
  metadata:
143
143
  documentation_uri: https://docs.oracle.com/en/learn/oci_logging_analytics_fluentd/
144
144
  source_code_uri: https://github.com/oracle-quickstart/oci-logan-fluentd-output-plugin
145
145
  changelog_uri: https://github.com/oracle-quickstart/oci-logan-fluentd-output-plugin/blob/main/CHANGELOG.md
146
- post_install_message:
146
+ post_install_message:
147
147
  rdoc_options: []
148
148
  require_paths:
149
149
  - lib
@@ -158,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubygems_version: 3.0.3.1
162
- signing_key:
161
+ rubygems_version: 3.3.27
162
+ signing_key:
163
163
  specification_version: 4
164
- summary: Fluentd output plugin for OCI Logging Analytics.
164
+ summary: Fluentd output plugin for OCI Log Analytics.
165
165
  test_files: []