Skip to main content
Send logs to Better Stack (formerly Logtail). Logs arrive with a dt timestamp, level, message, and the full meta object — queryable in Live tail and with SQL.

Setup

  1. In Better Stack, create a source (platform: JavaScript / HTTP) and copy its source token. Newer sources also show a dedicated ingesting host.
  2. Set the environment variables:
  1. Wire the transport:
  1. Trigger a request and watch Live tail.

Environment Variables

Options

Plus the shared batching options: maxBatchSize, flushIntervalMs, timeout, retries — see the overview.

Payload

Each log posts as one JSON object in a batched array:
Nested fields are queryable directly, e.g. context.requestId or request.method in SQL and Live tail filters.

Troubleshooting

  • 401 — the source token is wrong, or the source was deleted; copy a fresh token from the source settings.
  • Logs land in the wrong source — each source has its own token; double-check which one is in the environment.
  • Newer source, nothing arrives — sources with a dedicated ingesting host reject the legacy default endpoint; set BETTER_STACK_INGESTING_HOST.