The Axiom JavaScript SDK is an open-source project and welcomes your contributions. For more information, see the GitHub repository.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
Install SDK
To install the SDK, run the following:eval $(axiom config export -f)
to configure your environment variables. Otherwise, create an API token and export it as AXIOM_TOKEN
.
You can also configure the client using options passed to the constructor of the client:
Send data
The following example sends data to Axiom:flush()
before your application exits.
Query data
The following example queries data from Axiom:Capture errors
To capture errors, pass a methodonError
to the client:
onError
is set to console.error
.