Adapters

Axiom

Send logs to Axiom for powerful querying, dashboards, and alerting.

Axiom is a cloud-native logging platform with powerful querying capabilities. The evlog Axiom adapter sends your wide events directly to Axiom datasets.

Installation

The Axiom adapter is included in the main evlog package:

import { createAxiomDrain } from 'evlog/axiom'

Quick Start

1. Get your Axiom credentials

  1. Create an Axiom account
  2. Create a dataset for your logs
  3. Generate an API token with ingest permissions

2. Set environment variables

.env
NUXT_AXIOM_TOKEN=xaat-your-token-here
NUXT_AXIOM_DATASET=your-dataset-name

3. Create the drain plugin

server/plugins/evlog-drain.ts
import { createAxiomDrain } from 'evlog/axiom'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('evlog:drain', createAxiomDrain())
})

That's it! Your logs will now appear in Axiom.

Configuration

The adapter reads configuration from multiple sources (highest priority first):

  1. Overrides passed to createAxiomDrain()
  2. Runtime config at runtimeConfig.evlog.axiom
  3. Runtime config at runtimeConfig.axiom
  4. Environment variables (NUXT_AXIOM_* or AXIOM_*)

Environment Variables

VariableDescription
NUXT_AXIOM_TOKENAPI token with ingest permissions
NUXT_AXIOM_DATASETDataset name to ingest logs into
NUXT_AXIOM_ORG_IDOrganization ID (required for Personal Access Tokens)

You can also use AXIOM_TOKEN, AXIOM_DATASET, and AXIOM_ORG_ID as fallbacks.

Runtime Config

Configure via nuxt.config.ts for type-safe configuration:

nuxt.config.ts
export default defineNuxtConfig({
  runtimeConfig: {
    axiom: {
      token: '', // Set via NUXT_AXIOM_TOKEN
      dataset: '', // Set via NUXT_AXIOM_DATASET
    },
  },
})

Override Options

Pass options directly to override any configuration:

server/plugins/evlog-drain.ts
import { createAxiomDrain } from 'evlog/axiom'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('evlog:drain', createAxiomDrain({
    dataset: 'production-logs',
    timeout: 10000, // 10 seconds
  }))
})

Full Configuration Reference

OptionTypeDefaultDescription
tokenstring-API token (required)
datasetstring-Dataset name (required)
orgIdstring-Organization ID (for PAT tokens)
baseUrlstringhttps://api.axiom.coAxiom API base URL
timeoutnumber5000Request timeout in milliseconds

Querying Logs in Axiom

evlog sends structured wide events that are perfect for Axiom's APL query language:

// Find slow requests
['your-dataset']
| where duration > 1000
| project timestamp, path, duration, status

// Error rate by endpoint
['your-dataset']
| where level == "error"
| summarize count() by path
| order by count_ desc

// Request volume over time
['your-dataset']
| summarize count() by bin(timestamp, 1h)
| render timechart

Troubleshooting

Missing dataset or token error

[evlog/axiom] Missing dataset or token. Set NUXT_AXIOM_DATASET and NUXT_AXIOM_TOKEN

Make sure your environment variables are set and the server was restarted after adding them.

401 Unauthorized

Your token may be invalid or expired. Generate a new token in the Axiom dashboard with Ingest permissions.

403 Forbidden with PAT tokens

Personal Access Tokens require an organization ID:

.env
NUXT_AXIOM_ORG_ID=your-org-id

Direct API Usage

For advanced use cases, you can use the lower-level functions:

import { sendToAxiom, sendBatchToAxiom } from 'evlog/axiom'

// Send a single event
await sendToAxiom(event, {
  token: 'xaat-xxx',
  dataset: 'logs',
})

// Send multiple events in one request
await sendBatchToAxiom(events, {
  token: 'xaat-xxx',
  dataset: 'logs',
})
Copyright © 2026