From b155168282c1c6872e9e32795149be438cd9aaf7 Mon Sep 17 00:00:00 2001 From: Stanley Liu Date: Tue, 6 Aug 2024 16:28:48 -0400 Subject: [PATCH 1/2] Add docs for ddtags --- .../en/opentelemetry/integrations/log_collection.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/content/en/opentelemetry/integrations/log_collection.md b/content/en/opentelemetry/integrations/log_collection.md index a80f503d6f244..d678a9931b80a 100644 --- a/content/en/opentelemetry/integrations/log_collection.md +++ b/content/en/opentelemetry/integrations/log_collection.md @@ -82,6 +82,16 @@ filelog: {{< /tabs >}} +### Custom tags +In order to add custom Datadog tags to logs, set the `ddtags` attribute on the logs. For example, this can be done with the [transform processor][3]: +```yaml +transform: + log_statements: + - context: log + statements: + - set(attributes["ddtags"], "first_custom:tag, second_custom:tag") +``` + ## Data collected Logs from the configured files. @@ -141,3 +151,4 @@ Flags: 0 [1]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver [2]: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/datadogexporter/examples/logs.yaml +[3]: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor From 27ddd6bd994f8842c1a913160146953c7346fad8 Mon Sep 17 00:00:00 2001 From: Stanley Liu Date: Tue, 6 Aug 2024 16:46:43 -0400 Subject: [PATCH 2/2] Fix yaml --- .../en/opentelemetry/integrations/log_collection.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/content/en/opentelemetry/integrations/log_collection.md b/content/en/opentelemetry/integrations/log_collection.md index d678a9931b80a..92077e4fac51f 100644 --- a/content/en/opentelemetry/integrations/log_collection.md +++ b/content/en/opentelemetry/integrations/log_collection.md @@ -85,11 +85,12 @@ filelog: ### Custom tags In order to add custom Datadog tags to logs, set the `ddtags` attribute on the logs. For example, this can be done with the [transform processor][3]: ```yaml -transform: - log_statements: - - context: log - statements: - - set(attributes["ddtags"], "first_custom:tag, second_custom:tag") +processors: + transform: + log_statements: + - context: log + statements: + - set(attributes["ddtags"], "first_custom:tag, second_custom:tag") ``` ## Data collected