From b1c5836a4d93111418197752fd96842ff21a5648 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Thu, 9 Jan 2025 13:16:07 -0800 Subject: [PATCH] fix(logs): ensure logs are truncated to 256kb --- servers/otel-collector/otel-collector-config.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/servers/otel-collector/otel-collector-config.yaml b/servers/otel-collector/otel-collector-config.yaml index b90bd05ac..00e94edaa 100644 --- a/servers/otel-collector/otel-collector-config.yaml +++ b/servers/otel-collector/otel-collector-config.yaml @@ -15,6 +15,18 @@ exporters: # https://www.googlecloudcommunity.com/gc/Data-Analytics/OpenTelemetry-and-GKE/m-p/674090/highlight/true#M3861 timeout: 45s processors: + # https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/23847 + transform/google_logs: + log_statements: + - context: resource + statements: + - truncate_all(attributes, 256000) + - context: log + statements: + - set(attributes["truncate-body"], body) + - truncate_all(attributes, 256000) + - set(body, attributes["truncate-body"]) + - delete_key(attributes, "truncate-body") memory_limiter: check_interval: 1s limit_percentage: 70 @@ -94,6 +106,7 @@ service: receivers: [otlp] processors: [ + transform/google_logs, resource/cleanup_for_google, resourcedetection/ecs, memory_limiter,