Skip to content

Getting started

Install

git clone https://github.com/bruno-laranjo/loki-cli
cd loki-cli
make install
source .venv/bin/activate

Grab the appropriate artifact from the latest release and drop it on your $PATH:

  • loki-cli-linux-x86_64
  • loki-cli-windows-x86_64.exe

See Building binaries if you want to build locally.

docker run --rm <user>/loki-cli:latest --help

See Docker & Kubernetes.

First login

loki-cli login --url https://loki.example.com
# → Verifies the endpoint and saves the profile as `default`.

Or use a token:

loki-cli login --url https://loki.example.com --token "$LOKI_TOKEN"

Explore

loki-cli labels                 # what labels does the server carry?
loki-cli target --count         # what hosts / sources are shipping logs?
loki-cli logs my-host --since 15m
loki-cli logs my-host -f        # live tail

Multiple environments

loki-cli config set --profile prod --url https://loki.prod.example.com --token "$T_PROD"
loki-cli config set --profile dev  --url https://loki.dev.example.com  --token "$T_DEV"
loki-cli config use prod
loki-cli --profile dev target --count       # one-off against dev

Continue with Profiles & env vars for the full precedence rules.