Build on top

Identity headers

Every drain request sent by evlog is tagged with a User-Agent and an X-Evlog-Source header so receivers can identify the traffic.

All built-in adapters send two identity headers on every outgoing request:

HeaderValue
User-Agentevlog/<version> (Node / server runtimes only — browsers strip this header)
X-Evlog-SourceThe adapter name (axiom, datadog, otlp, posthog, sentry, better-stack, client, ...)

The browser-side evlog/http drain (used by the client transport) sets X-Evlog-Source: client instead, since browsers cannot override User-Agent.

Why

  • Quickly distinguish evlog traffic from other clients in the receiving system's logs.
  • Track adapter usage / version drift centrally.
  • Identify the source when debugging a specific drain.

Reading the version

Both constants are exported from evlog/toolkit:

import { EVLOG_USER_AGENT, EVLOG_VERSION } from 'evlog/toolkit'

console.log(EVLOG_VERSION)    // → "2.16.0"
console.log(EVLOG_USER_AGENT) // → "evlog/2.16.0"

Custom drains

When you build a drain on top of httpPost from evlog/toolkit, identity headers are injected automatically. To override or suppress them:

import { httpPost } from 'evlog/toolkit'

await httpPost({
  url: 'https://my-platform.example.com/ingest',
  headers: { 'Content-Type': 'application/json' },
  body: '[]',
  timeout: 5000,
  label: 'my-platform',
  source: 'my-platform',           // sent as X-Evlog-Source
  userAgent: 'my-fork/1.0',        // overrides the default User-Agent
  // userAgent: false,             // suppress the header entirely
})

Adapters built with defineHttpDrain() automatically pass the drain name as source.