axiom-go

module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: MIT

README

Go Reference Workflow Latest Release License

Axiom unlocks observability at any scale.

  • Ingest with ease, store without limits: Axiom’s next-generation datastore enables ingesting petabytes of data with ultimate efficiency. Ship logs from Kubernetes, AWS, Azure, Google Cloud, DigitalOcean, Nomad, and others.
  • Query everything, all the time: Whether DevOps, SecOps, or EverythingOps, query all your data no matter its age. No provisioning, no moving data from cold/archive to “hot”, and no worrying about slow queries. All your data, all. the. time.
  • Powerful dashboards, for continuous observability: Build dashboards to collect related queries and present information that’s quick and easy to digest for you and your team. Dashboards can be kept private or shared with others, and are the perfect way to bring together data from different sources.

For more information check out the official documentation and our community Slack.

Quickstart

Install using go get:

go get github.com/axiomhq/axiom-go/axiom

Import the package:

import "github.com/axiomhq/axiom-go/axiom"

If you use the Axiom CLI, run eval $(axiom config export -f) to configure your environment variables.

Otherwise create a personal token in the Axiom settings and export it as AXIOM_TOKEN. Set AXIOM_ORG_ID to the organization ID from the settings page of the organization you want to access.

You can also configure the client using options passed to the axiom.NewClient function:

client, err := axiom.NewClient(
    SetPersonalTokenConfig("AXIOM_TOKEN", "AXIOM_ORG_ID"),
)

Create and use a client like this:

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/axiomhq/axiom-go/axiom"
    "github.com/axiomhq/axiom-go/axiom/ingest"
)

func main() {
    ctx := context.Background()

    client, err := axiom.NewClient()
    if err != nil {
        log.Fatalln(err)
    }
    
    if _, err = client.IngestEvents(ctx, "my-dataset", []axiom.Event{
        {ingest.TimestampField: time.Now(), "foo": "bar"},
        {ingest.TimestampField: time.Now(), "bar": "foo"},
    }); err != nil {
        log.Fatalln(err)
    }

    res, err := client.Query(ctx, "['my-dataset'] | where foo == 'bar' | limit 100")
    if err != nil {
        log.Fatalln(err)
    }
    for _, match := range res.Matches {
        fmt.Println(match.Data)
    }
}

For further examples, head over to the examples directory.

If you want to use a logging package, check if there is already an adapter in the adapters directory. We happily accept contributions for new adapters.

License

Distributed under the MIT License.

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.
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.
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.
sas
Package sas implements functionality for creating and verifying shared access signatures (SAS) and shared access tokens (SAT).
Package sas implements functionality for creating and verifying shared access signatures (SAS) and shared access tokens (SAT).
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.
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.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL