Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,26 @@ In all cases the installation can be validated by running `axiom -v` in the
terminal:

```shell
$ axiom -v
Axiom CLI version 1.0.0
```

### Install using [Snap](https://snapcraft.io)

```shell
sudo snap install axiom
```

To send all system logs to Axiom:

```shell
# Allow Axiom to access system logs
sudo snap connect axiom log-observer

# Configure the background service
sudo snap set axiom journald-dataset=DATASET journald-url=URL journald-token=TOKEN
```

## Usage

```shell
Expand Down
21 changes: 21 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh -e

journald_token="$(snapctl get journald-token)"
journald_url="$(snapctl get journald-url)"
journald_dataset="$(snapctl get journald-dataset)"

cat <<EOL > ${SNAP_DATA}/journald-config
active_deployment = "journald-backend"

[deployments]
[deployments.journald-backend]
url = "${journald_url}"
token = "${journald_token}"
EOL

cat <<EOL > ${SNAP_DATA}/journald-env
AXIOM_DATASET="${journald_dataset}"
AXIOM_DEPLOYMENT=journald-backend
EOL

snapctl restart axiom.journald-ingester
23 changes: 23 additions & 0 deletions snap/local/bin/journald-ingester
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh -e

ENVFILE="${SNAP_DATA}/journald-env"
CONFFILE="${SNAP_DATA}/journald-config"

if [ ! -f "${CONFFILE}" ] ; then
echo "Journald configuration not available"
exit 0
fi

if [ ! -f "${ENVFILE}" ] ; then
echo "Journald environment not available"
exit 0
fi

. ${ENVFILE}

if [ -z ${AXIOM_DATASET} ]; then
echo "Configuration not complete: ${ENVFILE}"
exit 0
fi

exec journalctl --output=json --no-page --follow | ${SNAP}/bin/axiom ingest -C ${CONFFILE} ${AXIOM_DATASET}
36 changes: 36 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: axiom
base: core20
version: '0.1'
summary: The power of Axiom on the command line.
description: |
Axiom is a Next-Generation Data Platform
.
Axiom's coordination-free ingest, object-store based storage, and serverless querying mean that your organization's log management can be supercharged in the most efficient and affordable way.

grade: stable
confinement: strict

parts:
axiom-cli:
plugin: go
go-channel: 1.17/stable
source: .
prime:
- -bin/gen-cli-docs
override-prime: |
snapcraftctl prime
mkdir -p $SNAPCRAFT_PRIME/share/
$SNAPCRAFT_PRIME/bin/axiom completion bash > $SNAPCRAFT_PRIME/share/bash_completion
snap-helpers:
plugin: dump
source: snap/local

apps:
axiom:
plugs: [ "network" ]
command: bin/axiom
completer: share/bash_completion
journald-ingester:
plugs: [ "network", "log-observe" ]
command: bin/journald-ingester
daemon: simple