Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axiomhq/axiom-node

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axiomhq/axiom-node

The official NodeJS bindings for the Axiom API

  • 0.12.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

axiom-node: The official NodeJS bindings for the Axiom API axiom-node: The official NodeJS bindings for the Axiom API

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 Discord.

Quickstart

Install using npm install:

npm install @axiomhq/axiom-node

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 constructor of the Client:

const client = new Client({
    token: process.env.AXIOM_TOKEN,
    orgId: process.env.AXIOM_ORG_ID,
});

Create and use a client like this:

import { Client } from '@axiomhq/axiom-node';

async function main() {
  const client = new Client();

  await client.ingestEvents('my-dataset', [
    { 'foo': 'bar'},
  ]);

  const res = await client.query(`['my-dataset'] | where foo == 'bar' | limit 100`);
}

Using Axiom transport for Winston

You can use Winston logger to send logs to Axiom. First, install the winston and @axiomhq/axiom-node packages, then create an instance of the logger with the AxiomTransport.

import winston from 'winston';
import { WinstonTransport as AxiomTransport } from '@axiomhq/axiom-node';

const logger = winston.createLogger({
    level: 'info',
    format: winston.format.json(),
    defaultMeta: { service: 'user-service' },
    transports: [
        new AxiomTransport({
            dataset: 'my-dataset', // defaults to process.env.AXIOM_DATASET
            token: 'my-token', // defaults to process.env.AXIOM_TOKEN
            orgId: 'my-org-id', // defaults to process.env.AXIOM_ORG_ID
        }),
    ],
});

For further examples, see the examples directory.

License

Distributed under the MIT License.

Keywords

FAQs

Package last updated on 04 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc