Documentation ¶
Overview ¶
Package axiom implements Go bindings for the Axiom API.
Usage:
import "github.com/axiomhq/axiom-go/axiom" import "github.com/axiomhq/axiom-go/axiom/ingest" // When ingesting data import "github.com/axiomhq/axiom-go/axiom/otel" // When using OpenTelemetry import "github.com/axiomhq/axiom-go/axiom/query" // When constructing APL queries import "github.com/axiomhq/axiom-go/axiom/querylegacy" // When constructing legacy queries
Construct a new Axiom client, then use the various services on the client to access different parts of the Axiom API. The package automatically takes its configuration from the environment if not specified otherwise. Refer to axiom.NewClient for details. The token can be an API or personal token. The API token however, will just allow ingestion or querying into or from the datasets the token is valid for, depending on its assigned permissions.
To construct a client:
client, err := axiom.NewClient()
or with axiom.Option functions:
client, err := axiom.NewClient( axiom.SetToken("..."), axiom.SetOrganizationID("..."), )
Get the current authenticated user:
user, err := client.Users.Current(ctx)
NOTE: Every client method mapping to an API method takes a context.Context as its first parameter to pass cancellation signals and deadlines to requests. In case there is no context available, then context.Background can be used as a starting point.
For more code samples, check out the examples.
Directories ¶
Path | Synopsis |
---|---|
Package adapters provides packages which implement integration into well known Go logging libraries.
|
Package adapters provides packages which implement integration into well known Go logging libraries. |
apex
Package apex provides an adapter for the popular github.com/apex/log logging library.
|
Package apex provides an adapter for the popular github.com/apex/log logging library. |
logrus
Package logrus provides an adapter for the popular github.com/sirupsen/logrus logging library.
|
Package logrus provides an adapter for the popular github.com/sirupsen/logrus logging library. |
slog
Package slog provides an adapter for the standard libraries structured logging package.
|
Package slog provides an adapter for the standard libraries structured logging package. |
zap
Package zap provides an adapter for the popular github.com/uber-go/zap logging library.
|
Package zap provides an adapter for the popular github.com/uber-go/zap logging library. |
zerolog
Package zerolog provides an adapter for the popular github.com/rs/zerolog logging library.
|
Package zerolog provides an adapter for the popular github.com/rs/zerolog logging library. |
Package axiom implements Go bindings for the Axiom API.
|
Package axiom implements Go bindings for the Axiom API. |
ingest
Package ingest provides the datatypes and functions helping with ingesting data into Axiom.
|
Package ingest provides the datatypes and functions helping with ingesting data into Axiom. |
otel
Package otel provides helpers for using [OpenTelemetry] with Axiom.
|
Package otel provides helpers for using [OpenTelemetry] with Axiom. |
query
Package query provides the datatypes and functions for construction queries using the Axiom Processing Language (APL) and working with their results.
|
Package query provides the datatypes and functions for construction queries using the Axiom Processing Language (APL) and working with their results. |
querylegacy
Package querylegacy provides the datatypes and functions for construction legacy queries and working with their results.
|
Package querylegacy provides the datatypes and functions for construction legacy queries and working with their results. |
Package examples contains code examples on how to use Axiom Go.
|
Package examples contains code examples on how to use Axiom Go. |
apex
The purpose of this example is to show how to integrate with apex/log.
|
The purpose of this example is to show how to integrate with apex/log. |
ingestevent
The purpose of this example is to show how to send events to Axiom.
|
The purpose of this example is to show how to send events to Axiom. |
ingestfile
The purpose of this example is to show how to stream the contents of a JSON logfile and gzip them on the fly.
|
The purpose of this example is to show how to stream the contents of a JSON logfile and gzip them on the fly. |
ingesthackernews
The purpose of this example is to show how to replicate the contents of Hacker News into Axiom.
|
The purpose of this example is to show how to replicate the contents of Hacker News into Axiom. |
logrus
The purpose of this example is to show how to integrate with logrus.
|
The purpose of this example is to show how to integrate with logrus. |
otelinstrument
The purpose of this example is to show how to instrument the Axiom Go client using OpenTelemetry.
|
The purpose of this example is to show how to instrument the Axiom Go client using OpenTelemetry. |
oteltraces
The purpose of this example is to show how to send OpenTelemetry traces to Axiom.
|
The purpose of this example is to show how to send OpenTelemetry traces to Axiom. |
query
The purpose of this example is to show how to query a dataset using the Axiom Processing Language (APL).
|
The purpose of this example is to show how to query a dataset using the Axiom Processing Language (APL). |
querylegacy
The purpose of this example is to show how to query a dataset using a legacy query.
|
The purpose of this example is to show how to query a dataset using a legacy query. |
slog
The purpose of this example is to show how to integrate with slog.
|
The purpose of this example is to show how to integrate with slog. |
zap
The purpose of this example is to show how to integrate with zap.
|
The purpose of this example is to show how to integrate with zap. |
zerolog
The purpose of this example is to show how to integrate with zerolog.
|
The purpose of this example is to show how to integrate with zerolog. |
internal
|
|
config
Package config provides the base configuration for Axiom related functionality like URLs and credentials for API access.
|
Package config provides the base configuration for Axiom related functionality like URLs and credentials for API access. |
test/adapters
Package adapters provides helpers for dealing with adapter tests.
|
Package adapters provides helpers for dealing with adapter tests. |
test/testhelper
Package testdata provides - big surprise - helper functions to be used in tests.
|
Package testdata provides - big surprise - helper functions to be used in tests. |