BotNetwork

Logging and observability for bots: structure, redaction and alerts

If your logs contain bot tokens, you have an incident. Design redaction first.

Guide1 min readUpdated

What to log

  • Update / interaction id and platform
  • Handler name and outcome (ok, ignored, error class)
  • Latency buckets for ACK vs full reply
  • Rate-limit events (429, Retry-After)

What never to log

  • Bot tokens, webhook secrets, OAuth refresh tokens
  • Full message text when it may contain passwords or personal data (hash or truncate)
  • Raw authorization headers

Correlation

Propagate a request id from the webhook entrypoint through queue jobs and LLM calls so one user report maps to one trace.

Alerts that help

  • No successful heartbeat for N minutes
  • Error rate above a threshold
  • Signature verification failures (possible attack or wrong secret)

Related comparisons and tools