:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(logs): log the team when an internal logs header does not verify (#125349)
Jon McCallumac983ff9df77
diff --git a/nodejs/src/logs/internal-logs.ts b/nodejs/src/logs/internal-logs.tsindex f06263a7f080..33f9c492000e 100644--- a/nodejs/src/logs/internal-logs.ts+++ b/nodejs/src/logs/internal-logs.ts@@ -2,6 +2,7 @@ import { createHmac, timingSafeEqual } from 'crypto'import { Counter } from 'prom-client'import { buildIntegerMatcher } from '~/common/config/matchers'+import { logger } from '~/common/utils/logger'import type { ValueMatcher } from '~/types'export const INTERNAL_LOGS_HEADER = 'posthog-internal'@@ -109,6 +110,11 @@ export class InternalLogsVerifier {const policy = reason || !Object.hasOwn(this.policies, source) ? undefined : this.policies[source]if (!policy) {logsInternalLogsCounter.inc({ outcome: 'not_internal', reason: reason ?? 'unknown_source' })+ // The team is not a counter label, because a caller that rotates tokens would make its values unbounded.+ logger.warn('Internal logs header did not verify, batch billed as normal', {+ teamId,+ reason: reason ?? 'unknown_source',+ })return undefined}logsInternalLogsCounter.inc({ outcome: 'internal', reason: '' })