Skip to content

axiomhq/axiom-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axiom-py: The official Python bindings for the Axiom API axiom-py: The official Python bindings for the Axiom API

CI PyPI version Python version

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 pip:

# Linux / MacOS
python3 -m pip install axiom-py

# Windows
py -m pip install axiom-py

Alternatively, if you have the pip package installed, you can install axiom-py with the following command:

pip3 install axiom-py

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 client constructor:

import axiom

client = axiom.Client("<api token>", "<org id>")

Create and use a client like this:

import axiom
import rfc3339
from datetime import datetime,timedelta

client = axiom.Client()

time = datetime.utcnow() - timedelta(hours=1)
time_formatted = rfc3339.format(time)

client.ingest_events(
    dataset="my-dataset",
    events=[
        {"foo": "bar", "_time": time_formatted},
        {"bar": "baz", "_time": time_formatted},
    ])
client.query(r"['my-dataset'] | where foo == 'bar' | limit 100")

for more examples, check out the examples directory.

Contributing

This project uses Poetry for dependecy management and packaging, so make sure that this is installed (see Poetry Installation).

Run poetry install to install dependencies and poetry shell to activate a virtual environment.

License

Distributed under MIT License (The MIT License).