import Prerequisites from "/snippets/standard-prerequisites.mdx" import ReplaceDataset from "/snippets/replace-dataset.mdx"
Use the adapter of the Axiom Go SDK to send logs generated by the apex/log library to Axiom.
Set up SDK
-
Install the Axiom Go SDK and configure your environment as explained in Send data from Go app to Axiom.
-
In your Go app, import the
apexpackage. It’s imported as anadapterso that it doesn’t conflict with theapex/logpackage.import adapter "github.com/axiomhq/axiom-go/adapters/apex"
Alternatively, configure the adapter using options passed to the New function:
handler, err := adapter.New(
adapter.SetDataset("DATASET_NAME"),
)Configure client
To configure the underlying client manually, choose one of the following:
- Use SetClient to pass in the client you have previously created with Send data from Go app to Axiom.
- Use SetClientOptions to pass client options to the adapter.
import (
"github.com/axiomhq/axiom-go/axiom"
adapter "github.com/axiomhq/axiom-go/adapters/apex"
)
// ...
handler, err := adapter.New(
adapter.SetClientOptions(
axiom.SetPersonalTokenConfig("AXIOM_TOKEN"),
),
)Reference
For a full reference of the adapter’s functions, see the Go Packages page.