Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Platform overview

What is Axiom?QuickstartArchitectureFeatures
Fundamentals
Datasets
Edge deployments
Limits
Performance
Optimize usage
Requirements
Semantic conventions
Glossary
Tour
SecurityRoadmap

Send data

Reference architecturesMethods

Understand data

Console
Query
Builder
Editor
Query results
Visualize
Traces
Metrics
Correlations
Save queries
Stream
Dashboard
Create
Elements
Create
Configure
Element types
Gauge
Heatmap
Log stream
Monitor list
Note
Pie chart
Scatter plot
Statistic
Table
Time series
Sections
Configure
Filter
Monitor
Overview
View status
Configure
Examples
Monitor types
Anomaly
Match
New values
Threshold
Alerting
Overview
Configure
Notifier types
Amp
ChatGPT Workspace Agent
Claude Code
Cursor
Custom Webhook
Discord
Email
incident.io
Jira Service Management
Microsoft Teams
Opsgenie
PagerDuty
Slack
Annotations
Command Menu
Manage
Datasets
Overview
Views
Virtual fields
Access
RBAC
Tokens
CLI
Organization
Labels
Audit log
Settings
Usage and billing
Profile
Extend
Overview
AWS Lambda
AWS PrivateLink
Cloudflare Workers
Cloudflare Logpush
Convex
Grafana
Hex
Netlify
Supabase
Supabase metrics
Tailscale
Terraform
Unkey
Vercel
Intelligence
Overview
Spotlight
AI agents
Overview
MCP Server
Overview
Tools
Query cost limits
Agent-created orgs
Skills
Overview
Axiom alerting
Build dashboards
Control costs
SRE
Translate SPL to APL
Splunk
Overview
Splunk app
Install and configure
Commands
Traces
Examples
Portal
How it works
Set up standard mode
Set up transparent mode
Observability Cloud
OCSF data
OCSF as CIM
SPL command support
Examples
Monitor and troubleshoot

Use cases

ObservabilityProduct analytics
OCSF security data
Overview
Send data
Query data
LLM observability
Overview
Use Vercel AI SDK
Manual instrumentation
OpenAI Agents SDK
GenAI attributes
Redaction policies

Miscellaneous

LLMs
Overview
List of docs pages
Full docs
Query reference
FAQs
Legal
Acceptable use policy
Axiom for Startups terms
Committed use terms
Cookies
Data processing
HIPAA
Partner agreement
Partner program guide
Privacy policy
SLA
Terms of service
Terms of use

Send data with the Splunk HEC API

This page explains how to send data to Axiom from Splunk forwarders, the OpenTelemetry splunk_hec exporter, logging libraries, and custom clients through the Splunk HTTP Event Collector (HEC) compatible API.

Axiom offers a Splunk HTTP Event Collector (HEC) compatible API so you can send events from Splunk forwarders, the OpenTelemetry splunk_hec exporter, Splunk logging libraries, and custom HTTP clients without changing your existing tooling.

The HEC API is served from a dedicated host on your edge deployment: hec.AXIOM_DOMAIN. For example, if your edge deployment’s base domain is us-east-1.aws.edge.axiom.co, the HEC endpoint is https://hec.us-east-1.aws.edge.axiom.co.

To connect a SaaS product or security tool that offers a built-in Splunk destination, such as GitHub, Vercel, or Bitwarden, see Send data from products with a Splunk HEC destination.

Prerequisites

  • Create an Axiom account.
  • Create a dataset in Axiom where you send your data.
  • Create an API token in Axiom with permissions to ingest data to the dataset you have created.
Info

Replace AXIOM_DOMAIN with the base domain of your edge deployment. For more information, see Edge deployments.

The HEC endpoints are hosted at hec.AXIOM_DOMAIN, a dedicated subdomain of your edge deployment’s base domain.

Replace API_TOKEN with the Axiom API token you have generated. For added security, store the API token in an environment variable.

Replace DATASET_NAME with the name of the Axiom dataset where you send your data.

Authentication

Authenticate every request with an Axiom API token that has permission to ingest into the target dataset. The HEC API accepts the token in any of the following schemes:

SchemeHeader
Splunk (default HEC clients)Authorization: Splunk API_TOKEN
BearerAuthorization: Bearer API_TOKEN
BasicAuthorization: Basic <base64 of x:API_TOKEN> (for example, curl -u x:API_TOKEN)

Requests without a valid token are rejected with 401 Unauthorized (HEC code 2 when the token is missing, or 3 when the token is invalid) or 403 Forbidden (HEC code 4 when the token can’t ingest into the dataset, the dataset is shared, or the organization is suspended).

Choose the target dataset

In Splunk, events are routed by index. Axiom maps the HEC index to an Axiom dataset and resolves it in the following order:

  1. The index query parameter, for example ?index=DATASET_NAME.
  2. The index field inside the first event envelope. Axiom sends the entire request to that dataset. To split events across datasets, send separate requests.
  3. The dataset the API token is scoped to, when the token grants ingest access to exactly one dataset.

If none of these resolve to a dataset, the request is rejected with HEC code 7 (Incorrect index).

Send events

Send JSON events to /services/collector/event. The bare /services/collector path is an alias of the event endpoint. Each request body is one or more HEC event envelopes, which may be concatenated (newline-delimited or back-to-back).

shell
curl -X POST 'https://hec.AXIOM_DOMAIN/services/collector/event?index=DATASET_NAME' \
    -H 'Authorization: Splunk API_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{"event": {"message": "hello from HEC", "severity": "INFO"}, "sourcetype": "httpevent"}'

A successful ingest returns 200 OK with the Splunk status body:

JSON
{"text": "Success", "code": 0}

Event envelope fields

Axiom interprets the standard HEC envelope fields as follows:

FieldBehavior
eventWhen an object, its keys become top-level fields of the Axiom event. When a string, it’s stored in the _raw field.
fieldsMerged into the event as top-level fields.
timeParsed as the event timestamp (_time). Accepts epoch seconds, epoch milliseconds, or an RFC 3339 string. When omitted, Axiom assigns the ingest time.
indexSelects the target dataset (see Choose the target dataset) and is also retained as a field.
host, source, sourcetypeRetained as fields on the event.

Send raw events

Send arbitrary payloads to /services/collector/raw. Metadata is supplied through query parameters rather than an envelope. Each line of a text/plain body becomes an event; JSON bodies are also accepted.

shell
curl -X POST 'https://hec.AXIOM_DOMAIN/services/collector/raw?index=DATASET_NAME&sourcetype=mysourcetype&source=mysource&host=myhost' \
    -H 'Authorization: Splunk API_TOKEN' \
    -H 'Content-Type: text/plain' \
    --data-binary 'a raw log line
another raw log line'

Compressed payloads

The HEC API accepts gzip-compressed request bodies. Set Content-Encoding: gzip and send the gzipped payload:

shell
curl -X POST 'https://hec.AXIOM_DOMAIN/services/collector/event?index=DATASET_NAME' \
    -H 'Authorization: Splunk API_TOKEN' \
    -H 'Content-Type: application/json' \
    -H 'Content-Encoding: gzip' \
    --data-binary @events.json.gz

Check service health

GET /services/collector/health (and the versioned /services/collector/health/1.0) report whether the collector is accepting data. No authentication is required.

shell
curl 'https://hec.AXIOM_DOMAIN/services/collector/health'
JSON
{"text": "HEC is healthy", "code": 17}

Client examples

The following examples send events from Splunk logging libraries and from custom code.

Send logs from JavaScript using splunk-logging

javascript
var SplunkLogger = require('splunk-logging').Logger;

var config = {
  token: 'API_TOKEN',
  url: 'https://hec.AXIOM_DOMAIN:443/services/collector/event?index=DATASET_NAME',
};

var Logger = new SplunkLogger(config);

var payload = {
  // Message can be anything; doesn’t have to be an object
  message: {
    temperature: '70F',
    chickenCount: 500,
  },
};

console.log('Sending payload', payload);
Logger.send(payload, function (err, resp, body) {
  // If successful, body will be { text: 'Success', code: 0 }
  console.log('Response from Axiom', body);
});

Send logs from Python using splunk_handler

python
import logging
from splunk_handler import SplunkHandler
splunk = SplunkHandler(
        host='hec.AXIOM_DOMAIN',
        port='443',
        protocol='https',
        token='API_TOKEN',
        index='DATASET_NAME'
    )

logging.getLogger('').addHandler(splunk)

logging.warning('Hello from Axiom!')

Send logs from Go using net/http

go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
)

func main() {
	event := map[string]any{
		"time":       time.Now().Unix(),
		"sourcetype": "httpevent",
		"event": map[string]any{
			"message": "hello from Axiom",
			"level":   "info",
		},
	}
	body, _ := json.Marshal(event)

	req, _ := http.NewRequest(http.MethodPost, "https://hec.AXIOM_DOMAIN/services/collector/event?index=DATASET_NAME", bytes.NewReader(body))
	req.Header.Set("Authorization", "Splunk API_TOKEN")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Limitations

The Axiom HEC API differs from a Splunk HEC endpoint in the following ways:

  • Axiom only accepts HTTPS on port 443. Splunk’s default port 8088 isn’t available. Axiom redirects plain HTTP requests on port 80 to HTTPS, and many HTTP clients don’t resend the request body after the redirect.
  • Axiom doesn’t serve the versioned /services/collector/event/1.0 and /services/collector/raw/1.0 paths. Requests to these paths return 404. The versioned health path /services/collector/health/1.0 is available.
  • Axiom doesn’t support indexer acknowledgment. Axiom accepts the X-Splunk-Request-Channel header and the channel query parameter, but doesn’t serve /services/collector/ack.
  • Axiom stores the fields inside event, the fields object, and the standard envelope fields listed in Event envelope fields. Axiom doesn’t store other top-level fields of the envelope.

Response codes

Responses follow the Splunk HEC convention: an HTTP status code plus a JSON body carrying a Splunk code.

HTTP statusHEC codeMeaning
2000Success.
20017The collector is healthy (health endpoints only).
4005No data. The request body was empty.
4006Invalid data format. The body couldn’t be parsed, the dataset is in another edge deployment, or the dataset isn’t an events or logs dataset.
4007Incorrect index. The target dataset couldn’t be resolved.
4012Token missing.
4013Token invalid.
4034Token can’t ingest into the dataset, the dataset is shared, or the organization is suspended.
4047Dataset not found.
Was this page helpful?
Suggest edits on GitHub
On this page
AuthenticationChoose the target datasetSend eventsEvent envelope fieldsSend raw eventsCompressed payloadsCheck service healthClient examplesSend logs from JavaScript using splunk-loggingSend logs from Python using splunk_handlerSend logs from Go using net/httpLimitationsResponse codes