Skip to main content

Configuration

All configuration is via environment variables. Copy .env.example to .env and edit.


Required variables

VariableDescription
JWT_SECRETSecret key for signing JWT tokens. Use a random 32+ character string.
INITIAL_OWNER_EMAILEmail for the auto-created owner account on first startup
INITIAL_OWNER_PASSWORDPassword for the owner account
INITIAL_OWNER_NAMEDisplay name for the owner

Database

VariableDefaultDescription
DB_DRIVERpostgresDatabase driver
DB_HOSTpostgresPostgreSQL host
DB_PORT5432PostgreSQL port
DB_USERbatuserPostgreSQL user
DB_PASSWORDbatpasswordPostgreSQL password
DB_NAMEbatdbPostgreSQL database name

Redis / Queue

VariableDefaultDescription
REDIS_ADDRESSredis:6379Redis host:port
QUEUE_NAMEbataudit:eventsRedis queue key

Worker autoscaling

VariableDefaultDescription
WORKER_INITIAL_COUNT2Workers to start with
WORKER_MIN_COUNT2Minimum concurrent workers
WORKER_MAX_COUNT10Maximum concurrent workers
ENABLE_AUTOSCALINGtrueScale workers based on queue depth
SCALE_UP_THRESHOLD10Queue depth to trigger scale-up
SCALE_DOWN_THRESHOLD2Queue depth to trigger scale-down
COOLDOWN_PERIOD30sMinimum time between scaling events

API

VariableDefaultDescription
API_READER_PORT8082Reader/dashboard port
GIN_MODEreleasedebug or release
LOG_LEVELinfodebug, info, warn, error

Anomaly detection

VariableDefaultDescription
ANOMALY_COOLDOWN5mCooldown between alerts for same rule+service
ANOMALY_VOLUME_THRESHOLD3.0Z-score threshold for volume spike
ANOMALY_ERROR_RATE_THRESHOLD20.0Error rate % threshold
ANOMALY_BRUTE_FORCE_THRESHOLD10401 count for brute force detection
ANOMALY_MASS_DELETE_THRESHOLD50DELETE count for mass delete detection
ANOMALY_SILENT_SERVICE_MINUTES15Silence threshold in minutes

Data tiering

VariableDefaultDescription
TIERING_RAW_DAYS30Days to keep raw events
TIERING_HOURLY_DAYS365Days to keep hourly summaries
TIERING_HOUR2Hour (UTC) to run nightly aggregation

Notifications

VariableDefaultDescription
VAPID_PUBLIC_KEYVAPID public key for Web Push
VAPID_PRIVATE_KEYVAPID private key
VAPID_SUBJECTmailto:you@domain.com

Generate persistent VAPID keys:

go run ./cmd/api/reader/main.go --generate-vapid