Skip to content

Multi-Tenant Logging for B2B SaaS: Knowing Which Customer Broke First

In B2B SaaS, 'error rate is 0.8%' is useless if 100% of that 0.8% belongs to your largest enterprise renewal. Here is how to wire multi-tenant attribution cleanly.

Exla Engineering··6 min read

$0

High-cardinality tenant ID surcharge

API -> Queue -> DB

End-to-end tenant propagation

1 click

Drill from customer to exact trace

Key takeaway

Keep high-cardinality tenant_id values out of Prometheus metric labels (where they blow up series bills) and put them on structured OTLP logs and spans, where Libra Logs indexes them at zero cardinality surcharge.

Why aggregate error percentages lie in B2B SaaS

Consumer apps care about global p99 and overall 5xx percentages. B2B SaaS apps fail by account: one customer's malformed Salesforce schema or large workspace dataset breaks every request for that company while 99% of other tenants stay green.

Where to store tenant_id in modern telemetry
Telemetry signalHigh-cardinality tenant_id safe?Why
Prometheus / Datadog Custom MetricsNo (expensive)10,000 tenants x 15 routes = 150,000 billed custom metric series
Structured OTLP Logs & Spans (Libra)Yes (ideal)Columnar indexing groups by tenant_id with zero custom-metric fees

Three places tenant_id gets dropped (and how to fix all three)

Most apps log user_id on HTTP routes and lose tenant attribution as soon as work enters background queues or webhooks.

  • 1. BullMQ / SQS job payloads: Include { tenantId, traceparent } in your base job envelope so worker logs link straight to the triggering user click.
  • 2. Inbound webhooks: Resolve the external account ID (Stripe customer, Slack team_id, GitHub installation_id) to your internal tenant_id before running business logic.
  • 3. Scheduled cron loops: Emit one structured child span or log summary per tenant iteration rather than one giant unattributed cron log.

Built-in customer views without building an internal admin tool

Libra Logs automatically extracts tenant_id, workspace_id, org_id, and user identifiers across your services and builds a live per-customer health view for $20/mo (1-2 staff) or $150/mo (3-9 staff).

Simple pricing · 30-day free trial

Stop paying per indexed log event. Group bugs by customer instead.

$20/mo

1-2 employees · up to 25 GB

$150/mo

3-9 employees · up to 100 GB + Slack alerts

10+ staff

We beat your Datadog/Sentry bill

Talk to sales

FAQ

Common engineering questions

Does Libra Logs charge extra for 50,000+ distinct tenant or user IDs?

No. Unlike custom metric vendors that bill per unique tag combination, Libra Logs never charges cardinality fees on tenant or user identifiers.

Can we filter out internal test and staging accounts?

Yes. Configure internal email domains in Settings so test traffic never pollutes real customer alerts.