The Axiom Go SDK is an open-source project and welcomes your contributions. For more information, see the GitHub repository.
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.
Install SDK
To install the SDK, run the following:eval $(axiom config export -f) to configure your environment variables. Otherwise, create an API token and export it as AXIOM_TOKEN.
Alternatively, configure the client using options passed to the axiom.NewClient function:
Use client
Create and use a client in the following way:Configure region
By default, the client sends data toapi.axiom.co. To target a specific edge region, pass the SetEdge option with the edge domain that matches the region your dataset lives in:
AXIOM_TOKEN being set in your environment. To set the token in code as well, add axiom.SetToken("xaat-...").
The following edge domains are available:
For more information about edge deployments, see Edge deployments.
You can also configure the region without changing code by exporting environment variables:
axiom.SetEdgeURL("https://your-edge-host"). SetEdgeURL takes precedence over SetEdge if both are set.
Edge endpoints require an API token (
xaat-), not a personal token (xapt-). Ingest and query calls with a personal token against an edge endpoint return personal tokens are not supported for edge operations, use an API token (xaat-).