CLI
The lntrn command line for Lantern. Sign in to your organisation once, query logs, traces and metrics, and manage monitors, dashboards, synthetic flows, keys and edge credentials from a terminal or CI.
lntrn talks to your organisation's Lantern from a terminal, a script, an
agent or CI. It does the following:
- runs queries in the console's search language;
- manages monitors, silences, dashboards, synthetic flows, teams, keys and edge credentials;
- applies them from YAML kept in your repositories.
This page describes lntrn 1.0.1. It was called lantern before 1.0.1.
Install
lntrn isn't yet published anywhere you can download it without an account
on the GitLab that builds it. A public one-line install is on its way, and
this section will carry it once it is live.
With access to that GitLab, the installer picks the build for your OS and
architecture (Linux or macOS, amd64 or arm64), checks its checksum and
installs to /usr/local/bin, or ~/.local/bin:
curl -fsSL https://git.prod.wtf/xeonr/lantern/cli/-/raw/main/install.sh | GITLAB_TOKEN=<token with read_api> shLNTRN_VERSION=v1.0.1 pins a version, and LNTRN_INSTALL_DIR picks the
directory.
Sign in
lntrn loginlntrn login asks for your organisation: type its slug, or paste any URL
from its console (https://<org>.lntrn.dev/…). You can also name it up front
with lntrn login --org <org>, or lntrn login https://<org>.lntrn.dev.
The CLI reads your organisation's sign-in settings from
https://<org>.lntrn.dev/.well-known/lantern.json, then signs you in through
your organisation's identity provider:
- device code, when the provider offers it: open the URL it prints on any device and confirm the code;
- otherwise authorization code with PKCE, through a browser and a
loopback redirect on
http://127.0.0.1.
--no-browser prints the URL instead of opening one (over SSH, say).
If lntrn login fails with a redirect error, your provider's CLI client
doesn't allow the loopback redirect. Your organisation's admin can add
http://127.0.0.1 redirect URIs to the client named in lantern.json
(cli_client_id).
Profiles
Signing in saves a profile: your organisation, its URL, and who you signed in as. The profile is named after the organisation and becomes the current one, so every command after that acts in your organisation with no flag:
lntrn me # the profile in use, the organisation, and who you are
lntrn monitors list # in your organisationEach organisation you sign in to gets its own profile:
lntrn profile list # your profiles; * marks the current one
lntrn profile use <name> # switch to another
lntrn profile current # print the current profile's name
lntrn profile delete <name> # sign out of one and forget it
lntrn logout # the same, for the current profile (--all: every one)Running lntrn login for an organisation you already have a profile for
switches to it; --force signs in again.
For a single command, --profile <name> uses another profile, and
--org <org> acts in another organisation with that organisation's profile.
LNTRN_PROFILE and LNTRN_ORG do the same from the environment.
With no profile, commands don't guess: they stop and tell you to run
lntrn login.
Sign-ins and keys are kept in the OS keychain (macOS Keychain, the Secret
Service on Linux), or in ~/.config/lntrn/credentials.json at mode 0600
where there is none. ~/.config/lntrn/config.json holds the profiles and
nothing secret. A credential is only ever sent to its organisation's host,
and a sign-in refreshes itself.
Profiles arrived in lntrn 1.3.0. Upgrading from an earlier version turns
the sign-ins you already have into profiles, and the one you used most
recently becomes current. You don't sign in again.
Credentials and settings
The first credential found wins:
| What | |
|---|---|
LNTRN_API_KEY | A Lantern key (lk_…), for CI and scripts. It belongs to one organisation, so it also needs LNTRN_ORG or a profile for that organisation |
LNTRN_TOKEN | An access token from your identity provider, used as it is, in the profile's organisation (or LNTRN_ORG) |
| the profile | Its sign-in, or the key kept in it |
| Variable | Flag | |
|---|---|---|
LNTRN_PROFILE | --profile | The profile to use instead of the current one |
LNTRN_ORG | --org | Another organisation, by slug, for one command. The CLI talks to https://<org>.lntrn.dev |
LNTRN_URL | --url | A full base URL instead, such as https://<org>.lntrn.dev |
LNTRN_KEYRING=file | Keep credentials in the credentials file, not the keychain | |
LNTRN_CONFIG_DIR | Where the profiles and that file live. Default ~/.config/lntrn |
CI and scripts: Lantern keys
CI doesn't sign in. It uses a Lantern key, lk_…, which belongs to your
organisation and acts with a role no higher than its creator's:
lntrn keys create --name "ci: checkout deploys" --role editor --expires 90d
lntrn keys create --name "ci: platform" --role editor --team platform --expires 90dEditors can make keys of their own, and admins team keys. Keys are also under Settings → Keys in the console. A key:
- is printed once;
- must expire, within 365 days;
- is re-checked on every use against its creator's current role, and stops working if the creator loses access.
A team key (--team) acts as that team for anything the team owns. Use
one for a pipeline that applies a team's monitors and dashboards, so its
objects don't depend on one person.
A CI job names the key's organisation once, next to the key:
# .gitlab-ci.yml, a GitHub Actions env block, or similar
variables:
LNTRN_ORG: <org>
LNTRN_API_KEY: $LNTRN_API_KEY # a protected, masked CI secretWhere the machine keeps its home directory between runs (a runner host, a script on a server), keep the key in a profile instead. It's read from stdin, checked against the organisation, and stored like a sign-in:
lntrn profile create ci --org <org> --api-key < key.txtlntrn keys list
lntrn keys revoke <id> --yesQueries
lntrn query takes the console's search-bar language, so a query copied
from the console means the same here:
key:value key:"a value" -key:value equals / not equals
key:(a OR b) -key:(a OR b) in / not in
key:>n key:>=n key:<n key:<=n ranges (durations take units: >500ms)
key:* -key:* exists / does not exist
key:*text* contains
key:prefix* starts with
key:/re/ regular expression
word "exact phrase" -word free text (logs, traces)
synthetic:include|exclude|only the synthetics runner's telemetry (hidden by default)lntrn query logs 'service.name:checkout-api severity:(error OR warn) timeout' --since 1h
lntrn query logs 'k8s.namespace.name:checkout' --follow # live tail
lntrn query traces 'service.name:checkout-api duration:>2s' --limit 20
lntrn query traces 'service.name:checkout-api' --agg p95 --of duration --group-by span.name --table
lntrn query metrics --agg rate --of traces_span_metrics_calls_total --group-by service.name --table
lntrn query events 'k8s.cluster.name:prod' --since 1h # Kubernetes eventsThe synthetics runner's own telemetry (service.name:lantern-synthetics) is
left out of logs and traces unless you ask for it. Add synthetic:include
to the query (or --synthetic include) to see it with everything else, or
synthetic:only to see synthetic runs alone. What a run causes in your
services always shows, tagged lantern.synthetic=true. Add
-lantern.synthetic:true to leave it out. Metrics are not filtered: span
metrics count a synthetic request like any other.
lntrn query traces 'service.name:checkout-api synthetic:include' --since 1h
lntrn query logs 'synthetic:only severity:error' --since 1h
lntrn query logs 'service.name:checkout-api -lantern.synthetic:true' --since 1hWithout --agg a query returns rows; with it, series, or one value per group
with --table. Metrics always need --agg, with the metric name in --of.
--since 15m is the default window. --json prints the API's response,
and --print-request shows the request a query compiles to.
Monitors, silences and channels
lntrn monitors list --state alert
lntrn monitors get "checkout-api: error logs"
lntrn monitors apply -f monitors.lantern.yaml --dry-run
lntrn monitors export --all --team platform -o monitors.lantern.yaml
lntrn silences create --monitor "checkout-api: error logs" --for 2h --reason "deploying"
lntrn silences create --match service.name=checkout-api --until 2026-11-01T09:00:00Z --reason "maintenance"
lntrn channels list
lntrn channels test oncallmonitors apply creates or updates each monitor by name, and never deletes
one that is missing from the file:
owner_team: urn:lantern:team:<org>:platform
monitors:
- name: "checkout-api: error logs"
kind: MONITOR_KIND_QUERY_RULE
severity: MONITOR_SEVERITY_WARNING
channels: [oncall]
service_name: checkout-api
query:
signal: SIGNAL_LOGS
filters:
- {key: service.name, op: FILTER_OP_EQ, values: [checkout-api]}
- {key: severity, op: FILTER_OP_IN, values: [error, fatal]}
agg: {fn: AGGREGATION_FN_COUNT}
condition: {threshold: 10, comparator: COMPARATOR_GT, window: 5m}Channels are created in the console. A monitor names them by name.
A metrics monitor's entry can also set no_data, which says when a group
that stops reporting goes NO_DATA and what that does. An entry without it
leaves an existing monitor's setting alone. See
No data. monitors export writes
monitors back in this shape, no_data included.
Dashboards
lntrn dashboards list
lntrn dashboards export "Checkout" -o dashboard.lantern.yaml
lntrn dashboards apply -f dashboard.lantern.yaml --dry-runBuild a dashboard in the console, export it, keep the file in the service's
repository, and apply it from CI. apply matches by id, then by name, and
leaves an unchanged dashboard alone.
Teams and ownership
Monitors, dashboards, flows and the rest can belong to a team. In your organisation, a team is a Lantern team mapped to one or more of your identity provider's groups. Its members are whoever's sign-in carries one of them, and Lantern keeps no membership list of its own. Admins manage them:
lntrn teams create platform --name Platform --group platform --group sre
lntrn teams list
lntrn services owner set checkout-api --team platformA team's URN, urn:lantern:team:<org>:<slug>, is what YAML files put in
owner_team. The slug never changes.
Synthetic flows
Flows are scripted checks (HTTP, gRPC, WebSocket, DNS, ping, TCP port) that run on a schedule, alert like monitors and can feed status pages:
name: "checkout: health"
service_name: checkout-api
owner_team: urn:lantern:team:<org>:platform
kind: KIND_FLOW
interval: 5m
down_after: 3
channels: [oncall]
steps:
- name: healthz
http: {method: GET, url: https://checkout.example.com/healthz}
assert:
- {source: SOURCE_STATUS, op: OP_EQ, value: "200"}
- {source: SOURCE_LATENCY, op: OP_LT, value: 3s}lntrn synthetics flows apply --dry-run -f flows.lantern.yaml # validate only
lntrn synthetics flows apply --test-first -f flows.lantern.yaml
lntrn synthetics flows run "checkout: health"
lntrn synthetics flows runs "checkout: health"
lntrn synthetics secrets set CHECKOUT_TOKEN --value-file token.txtA flow that doesn't say enabled: is applied enabled. --test-first runs
each flow once as a draft and applies only those that pass. Secret values are
read from a file, stdin or a hidden prompt, never from a flag.
Flows run on runners. A flow with no locations runs on your
organisation's own runners, or, if it has none, on the default shared runner
(today ionos-uk, in the UK). Any other shared runner (today ovh-bhs, in
Canada) runs only the flows that name its location. See Synthetic flows.
Declarations
A repository can declare what Lantern should hold for it, in files at its root, one per type:
| File | Holds | Applied by |
|---|---|---|
service.lantern.yaml | owner_team, services: [...] | lntrn services apply -f |
dashboard.lantern.yaml | a dashboard (several, separated by ---) | lntrn dashboards apply -f |
monitors.lantern.yaml | owner_team, monitors: [...] | lntrn monitors apply -f |
flows.lantern.yaml | synthetic flows | lntrn synthetics flows apply -f |
Run each file's command in CI on your default branch, with --dry-run on
merge requests. Every apply reports what it created, updated or left alone,
and nothing is ever deleted.
lntrn lint and lntrn apply, which check and apply every file at once,
currently refuse a Lantern team URN in service.lantern.yaml. Use the
per-file commands above until that is fixed.
Recording deploys
lntrn deploys record tells Lantern who deployed a version of a service, and
from which pipeline. The deploy marker then shows the commit and the run:
lntrn deploys record --service checkout --version 1.42.0 --env prod
lntrn deploys record --service checkout --version 1.41.3 --env prod --rollback-of 1.42.0 --reason "error rate"--commit, --ref, --repository, --pipeline-id and --deployed-by
default to the CI run's variables (CI_COMMIT_SHA, CI_COMMIT_REF_NAME,
CI_PROJECT_PATH, CI_PIPELINE_IID, GITLAB_USER_LOGIN). Recording the same
deploy twice writes the same record.
On branchd: Lantern's steps
Not switched on yet. Until it is, apply and release use LANTERN_API_KEY
as before and say so in their log.
On branchd, Lantern publishes its own CI steps:
| Step | Does |
|---|---|
xeonr/lantern/cli/steps/lint@v1 | lntrn lint of the repository. It needs no credential. |
xeonr/lantern/cli/steps/apply@v1 | lntrn apply --prune, declared in the repository |
xeonr/lantern/cli/steps/release@v1 | lntrn deploys record, with service, version, and optionally environment, rollback_of and reason |
apply and release authenticate with the job's own identity, which Xeonr
Auth exchanges for a short-lived Lantern token, so no key needs to be stored in
CI. Lantern holds that token to the repository's team and to what the
repository declares:
applycreates dashboards, monitors and flows declared in its own repository, and updates, prunes or moves only those. It never takes over an object made in the console or declared nowhere. A person hands those to the repository first, which is a one-off step (see below). It never touches another repository's objects, another team's, or unowned ones.- A flow that uses a synthetic secret, a credential or a tunnel (
via) is never applied from a pipeline's identity. Apply it with your own sign-in or the team key until those can be bound to a repository. This holds after the apply too: Lantern opens no secret, credential or tunnel for a flow a pipeline last wrote, and a step template such a flow includes cannot gain one. To give it one, re-apply the flow as a person first; from then on it is yours, not the pipeline's, until the pipeline next writes it. - A monitor names only channels the team's monitors already use.
releaserecords deploys only of services handed to the repository, with the run's own repository, commit, ref, run and pusher. It never claims a service, and never replaces another repository's record.- Writes need a protected branch or tag. Neither step can reach keys, members, channels, secrets, settings or anything an admin does.
Handing objects to a repository. Do this once, as a person:
- Monitors: select them in the monitors list and choose Hand to a repository….
- Dashboards and flows: run
lntrn apply --declared-in <group/project>in the repository with your own sign-in or the team key. - Services: in the repository, run
lntrn services apply -f service.lantern.yaml --declared-in <group/project>.
From then on the repository's CI manages what was handed to it, and nothing else. Each handover is in the audit log, with the repository the object was declared in before and after.
If people rely on what a step does with your identity, pin it to an exact
version (@1.16.2) rather than @v1, which runs the newest v1.x the step's
repository has tagged.
Sending telemetry
The CLI manages what lets senders in:
lntrn edge-credentials create --name "prod cluster" # admins: prints the password once, plus SDK and Collector config
lntrn edge-credentials list
lntrn edge-credentials revoke <id> --yes
lntrn client-projects listSee Server telemetry for what to do with an edge credential.
Output and exit codes
Tables by default. --json prints the API's response as JSON, stable enough
to diff and to pipe to jq. With --follow, it prints one JSON object per
line. Errors are the API's own, word for word.
| Code | |
|---|---|
0 | It worked |
1 | It failed, or a check did not pass |
2 | Partly applied: some documents of an apply landed and a later one did not |
130 | Interrupted; a run already started carries on server-side |
Verify
lntrn meIt prints the profile in use, your name, your role and your organisation.
With LNTRN_API_KEY set, it prints the key's role instead. lntrn auth status
says which profile and credential were used, if the result surprises you.
Status pages
Public pages that show your synthetic flows' state, served by Lantern at a built-in URL or a hostname of your own, and restyled with your own CSS.
MCP
Connect Claude to your organisation's Lantern over the Model Context Protocol. Query logs, traces and metrics, work alerts and monitors, and manage dashboards and synthetic checks as yourself.