Skip to main content

💻 CLI commands

The kwatch binary runs the monitor and ships a few commands for validating a configuration and exporting a recording. Most users only need kwatch lint. The commands run inside the kwatch pod, for example:

kubectl -n kwatch exec deploy/kwatch -- kwatch lint
CommandWhat it doesEdition
kwatchRun the monitorCommunity and Pro
kwatch versionPrint the version, commit and build dateCommunity and Pro
kwatch lintValidate the configurationCommunity and Pro
kwatch replay-exportExport the flight recordingPro

An unknown command exits with code 2 and does not start the monitor.

kwatch — run the monitor​

Starts the monitor. It reads the config from the CONFIG_FILE environment variable (default /config/config.yaml).

kwatch version — print the version​

kwatch version
# version v1.0.0 (commit abc1234, built 2026-01-01T00:00:00Z)

kwatch version --json

--json prints the same data plus the active edition. The older --version flag still prints only the short version.

kwatch lint — validate configuration​

Checks your config file without running the monitor.

kwatch lint
# config OK
FlagDescription
--strictReject unknown or misspelled config fields instead of warning
--checkAlso contact each provider that supports checks and verify its credentials
kwatch lint --check
# slack: OK
# email: FAIL — could not connect to SMTP server

Lint exits 1 on an error and prints warnings, which are not fatal, for settings that work but may mislead. It also prints an info: line for each Pro setting your configuration contains while the edition is Community. Those settings are ignored, and the file stays valid for an upgrade. A real configuration check includes provider names and settings, ports, thresholds and silences. Lint requires at least one alert provider, although the monitor itself can run without one.

kwatch replay-export — export the flight recording Pro​

kwatch keeps a sanitized flight recording of what its sources observed (48 hours, capped at 64 MiB). replay-export writes a window of it as a log the scenario library can replay. Names are hashed pseudonyms, and log and event text is dropped, so the file is safe to share.

kubectl exec -n kwatch deploy/kwatch -- \
kwatch replay-export --since 2h --out /var/lib/kwatch/incident.jsonl
kubectl cp kwatch/<pod>:/var/lib/kwatch/incident.jsonl ./incident.jsonl
FlagDescription
--sinceStart of the window: a duration back (2h) or an RFC 3339 time. Required in practice
--untilEnd of the window, same format; default is now
--stateState file to read; default is the kwatch state file
--outFile to write. Required

The state file is locked while kwatch runs, so the command works on a copy next to the output file and needs free space for it. In Community the command exits with replay-export is a kwatch Pro feature.

Internal commands (used by the installer)​

The binary also has kwatch license subcommands. The kwatch.sh installer calls them for you from its License / Pro menu, so you do not need to run them. To manage a license, run the installer (/bin/bash -c "$(curl -fsSL https://kwatch.dev/kwatch.sh)") and see License.

Environment variables​

VariableDefaultDescription
CONFIG_FILE/config/config.yamlPath to the YAML config file
POD_NAMESPACEdetected from the podNamespace kwatch runs in
KWATCH_LICENSE_KEYemptyPro license key; wins over license.key
KWATCH_DATA_DIR/var/lib/kwatchDirectory of the state file
GOMEMLIMITbased on the resource limitSoft Go memory limit

The config file supports ${VAR} for non-sensitive strings. Credentials must use an absolute file reference backed by a mounted Secret:

alert:
slack:
webhook: "${file:/config/slack-webhook}"

Exit codes​

CodeMeaning
0Success
1Config error, lint failure, runtime error, or a Pro-only command in Community
2Unknown command or wrong arguments

When kwatch receives SIGTERM or SIGINT it shuts down gracefully: it marks readiness false, stops monitoring and delivery, waits for persistence writers, and exits with code 0.