Skip to content

Configuration

The agent and core are configured through environment variables. The Docker Compose examples keep server values in .env.

All agent variables use the KANSHI_ prefix.

Variable Default Description
KANSHI_CORE_ADDR 127.0.0.1:50051 gRPC address of the core service
KANSHI_API_KEY (empty) API key sent to core for authentication
KANSHI_TLS false Use TLS with system certificate roots
KANSHI_TLS_CA_FILE (empty) Optional PEM CA file added to system roots; requires TLS
KANSHI_TLS_SERVER_NAME (empty) Optional certificate server-name override; requires TLS
KANSHI_LOG_LEVEL info Log level (debug, info, …)
KANSHI_INTERVAL 5s How often metrics are collected (Go duration)
KANSHI_BATCH_MAX 100 Max points buffered before a flush
KANSHI_FLUSH_EVERY 10s Max time between flushes regardless of batch size (Go duration)
KANSHI_HOST_TAGS (empty) Comma-separated tags appended to every metric from this host

Example: a production host reporting to a remote core every 10 seconds:

Terminal window
KANSHI_CORE_ADDR=core.internal:50051 \
KANSHI_API_KEY=replace-with-the-ingest-key \
KANSHI_INTERVAL=10s \
KANSHI_HOST_TAGS=env:prod,region:us-east \
kanshi-agent

Core reads its database connection from these variables:

Variable Default Description
DB_HOST localhost PostgreSQL/TimescaleDB host
DB_PORT 5432 Database port
DB_USER kanshi Database user
DB_PASSWORD kanshi Database password
DB_NAME kanshi Database name
KANSHI_API_KEY none Required shared key for agent ingest
KANSHI_DASHBOARD_KEY none Required bearer key for /api/v1
KANSHI_ALLOWED_ORIGINS none Comma-separated dashboard origins allowed by CORS
KANSHI_ALERT_INTERVAL 30s How often alert rules are evaluated (Go duration)
KANSHI_WEBHOOK_URLS (empty) Comma-separated webhook URLs for alert delivery
KANSHI_WEBHOOK_SECRET (empty) Optional secret for HMAC-SHA256 signing of webhook payloads
KANSHI_TRACE_RETENTION 168h Trace retention as a Go duration, minimum 1h
KANSHI_LOG_RETENTION 72h Correlated log retention as a Go duration, minimum 1h

The listen ports are fixed in v1: authenticated Agent and OTLP/gRPC ingestion on :50051, REST on :8080.