Skip to Content
Docs

Log drains to Axiom

Send the logs of your workspace to an Axiom dataset with a log drain.

The type axiom sends the records of a log drain to an Axiom dataset. You need an API key with the scope log_drains:write. A log drain is a feature of the Business plan.

Prepare Axiom

  1. Make a dataset in Axiom.
  2. Make an API token with the ingest permission for the dataset. A personal access token does not work.
  3. Find the region of your organization: us-east-1 or eu-central-1.

Make the log drain

curl https://api.afffast.com/v1/log_drains \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "axiom",
    "label": "Axiom",
    "config": { "dataset": "afffast-logs", "region": "us-east-1" },
    "credentials": { "api_token": "xaat-..." },
    "sources": ["api_request", "delivery", "sync_run"]
  }'
  • dataset is the name of the dataset. It must exist. Use letters, digits and the characters _ . -.
  • region is us-east-1 or eu-central-1.
  • api_token is write-only. The API never returns it.

POST /v1/log_drains/{id}/test sends one sample record ("test": true).

What Axiom gets

Each record is one event. It has the field _time (the time of the record) and all fields of the record: id, object, source, level, timestamp, workspace, livemode, test and data. The API sends NDJSON that it compresses with gzip. One request has 1000 records or 3 MiB at most. This is below the limit of Axiom (4 MiB for one request).

Use id to remove duplicates. Delivery is at least once.

Errors

Answer of AxiomWhat the API does
2xxThe batch is done.
429The API waits and tries again.
401, 403The API stops the log drain (failing). The token is wrong or has no ingest permission.
404The API stops the log drain (failing). The dataset does not exist, or the region is wrong.
2xx with failed above 0The API skips the events that Axiom did not ingest, and goes on. It does not send them again.
400The API stops the log drain (failing).
413The API sends the batch in smaller parts.
408, 5xx, other, no answerThe API tries again with a growing wait.

See Log drains for the retry wait and the resume of a log drain that failed.

On this page