package
0.20.2
Repository: https://github.com/axiomhq/axiom-go.git
Documentation: pkg.go.dev

# README

Axiom Go Adapter for apex/log

Adapter to ship logs generated by apex/log to Axiom.

Quickstart

Follow the Axiom Go Quickstart to install the Axiom Go package and configure your environment.

Import the package:

// Imported as "adapter" to not conflict with the "apex/log" package.
import adapter "github.com/axiomhq/axiom-go/adapters/apex"

You can also configure the adapter using options passed to the New function:

handler, err := adapter.New(
    adapter.SetDataset("AXIOM_DATASET"),
)

To configure the underlying client manually either pass in a client that was created according to the Axiom Go Quickstart using SetClient or pass client options to the adapter using SetClientOptions.

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", "AXIOM_ORG_ID"),
    ),
)

[!IMPORTANT] The adapter uses a buffer to batch events before sending them to Axiom. This buffer must be flushed explicitly by calling Close. Checkout out the example.

# Functions

New creates a new handler that ingests logs into Axiom.
SetClient specifies the Axiom client to use for ingesting the logs.
SetClientOptions specifies the Axiom client options to pass to [axiom.NewClient] which is only called if no [axiom.Client] was specified by the [SetClient] option.
SetDataset specifies the dataset to ingest the logs into.
SetIngestOptions specifies the ingestion options to use for ingesting the logs.

# Variables

ErrMissingDatasetName is raised when a dataset name is not provided.

# Structs

Handler implements a [log.Handler] used for shipping logs to Axiom.

# Type aliases

An Option modifies the behaviour of the Axiom handler.