v2.4.2

Logs

Lambda logs are structured JSON and are exported to Grafana Loki through the OpenTelemetry collector layer.

Emitting

Use the shared logging package from libs/logging:

ts
import { Logger, TraceUtils } from '../../../libs/logging'

const traceContext = TraceUtils.extractTraceContext(event, context)
const logger = new Logger(traceContext)

logger.info('leadsInboundHeyflowQueue.handle - Init', { requestId, origin })
logger.error('handle - BadRequest', new Error('BadRequest'), { requestId })

TraceUtils.extractTraceContext attaches trace metadata so Loki logs can be correlated with Tempo spans by traceId and spanId.

Lambda log format

Default logging config is inherited from serverless.common.yml:

yaml
provider:
  logs:
    lambda:
      logFormat: JSON
      applicationLogLevel: INFO
      systemLogLevel: INFO
  logRetentionInDays: 30

leads overrides retention to 90 days. The collector's telemetryapi receiver captures Lambda platform logs and function logs.

Loki queries

By service and environment:

logql
{ service_name = "drive-api-leads", deployment_environment = "prod" } |= "BadRequest"

By trace id:

logql
{ trace_id = "<tempo-trace-id>" }

The collector drops ADOT boot noise and Node DeprecationWarning entries through filter/logs in collector.yaml.

Esc