From 2dcb1a67a12eb105be4e51e61bc7d9382b88738a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 21 Jul 2023 14:16:43 +0200 Subject: [PATCH] Add service name to the logs only on self-host --- packages/backend-core/src/logging/pino/logger.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/logging/pino/logger.ts b/packages/backend-core/src/logging/pino/logger.ts index f2024db72b..7439755030 100644 --- a/packages/backend-core/src/logging/pino/logger.ts +++ b/packages/backend-core/src/logging/pino/logger.ts @@ -19,8 +19,14 @@ if (!env.DISABLE_PINO_LOGGER) { return { level: label.toUpperCase() } }, bindings: () => { - return { - service: env.SERVICE_NAME, + if (env.SELF_HOSTED) { + // "service" is being injected in datadog using the pod names, + // so we should leave it blank to allow the default behaviour if it's not running self-hosted + return { + service: env.SERVICE_NAME, + } + } else { + return {} } }, },