From 0ca833ef9a42a185e94ff9ac92d0a991a061b525 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 23:11:23 +0100 Subject: [PATCH] [azure-eventhub] Make the azure-eventhub input v1 tracer opt-in (#41932) (#41941) Make the `azure-eventhub` input v1 internal logs tracer opt-in. To enable internal (legacy) Event Hub SDK logs, now you need to set the following environment variable: ```sh BEATS_AZURE_EVENTHUB_INPUT_TRACING_ENABLED: true ``` Before this change, the tracer was enabled by default. A few customers reported higher than anticipated error logs in edge cases. These error logs are an essential signal to troubleshoot the root cause of several issues. However, we should give the option to completely opt out from the internal logs tracing when needed. (cherry picked from commit 3b5823fb631836927b82639e6dc6892236950897) Co-authored-by: Maurizio Branca --- CHANGELOG.next.asciidoc | 1 + x-pack/filebeat/docs/inputs/input-azure-eventhub.asciidoc | 5 ++++- x-pack/filebeat/input/azureeventhub/tracer.go | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 03e7d0003321..924bd136df67 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -215,6 +215,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Add ability to remove request trace logs from entityanalytics input. {pull}40004[40004] - Improve S3 polling mode states registry when using list prefix option. {pull}41869[41869] - AWS S3 input registry cleanup for untracked s3 objects. {pull}41694[41694] +- The environment variable `BEATS_AZURE_EVENTHUB_INPUT_TRACING_ENABLED: true` enables internal logs tracer for the azure-eventhub input. {issue}41931[41931] {pull}41932[41932] *Auditbeat* diff --git a/x-pack/filebeat/docs/inputs/input-azure-eventhub.asciidoc b/x-pack/filebeat/docs/inputs/input-azure-eventhub.asciidoc index 81cfdc66d524..808c46b83331 100644 --- a/x-pack/filebeat/docs/inputs/input-azure-eventhub.asciidoc +++ b/x-pack/filebeat/docs/inputs/input-azure-eventhub.asciidoc @@ -13,7 +13,10 @@ Users can make use of the `azure-eventhub` input in order to read messages from The azure-eventhub input implementation is based on the the event processor host (EPH is intended to be run across multiple processes and machines while load balancing message consumers more on this here https://github.com/Azure/azure-event-hubs-go#event-processor-host, https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host). State such as leases on partitions and checkpoints in the event stream are shared between receivers using an Azure Storage container. For this reason, as a prerequisite to using this input, users will have to create or use an existing storage account. - +Users can enable internal logs tracing for this input by setting the environment +variable `BEATS_AZURE_EVENTHUB_INPUT_TRACING_ENABLED: true`. When enabled, +this input will log additional information to the logs. Additional information +includes partition ownership, blob lease information, and other internal state. Example configuration: diff --git a/x-pack/filebeat/input/azureeventhub/tracer.go b/x-pack/filebeat/input/azureeventhub/tracer.go index f998a548e373..8ba77af3b4d3 100644 --- a/x-pack/filebeat/input/azureeventhub/tracer.go +++ b/x-pack/filebeat/input/azureeventhub/tracer.go @@ -8,6 +8,7 @@ package azureeventhub import ( "context" + "os" "github.com/devigned/tab" @@ -15,7 +16,12 @@ import ( ) func init() { - tab.Register(new(logsOnlyTracer)) + // Register the logs tracer only if the environment variable is + // set to avoid the overhead of the tracer in environments where + // it's not needed. + if os.Getenv("BEATS_AZURE_EVENTHUB_INPUT_TRACING_ENABLED") == "true" { + tab.Register(new(logsOnlyTracer)) + } } // logsOnlyTracer manages the creation of the required