Environment Variable Reference -- cortex

July 30, 2026 · View on GitHub

Concise reference. See CONFIG.md for full documentation including config.toml overlay and validation rules.

Deployment paths

cortex serve mcp runs as an HTTP MCP server because it needs persistent syslog UDP/TCP listeners:

PathHowCredentials
PluginClaude Code connects via HTTP; server mode delegates setup to cortex setup repair / cortex setup deploy local${user_config.*} in .mcp.json; setup writes ~/.cortex/.env
One-line installercurl .../install.sh | sh then cortex setup~/.cortex/.env
Dockerdocker compose up -d.env file
Bare metalcargo run --release -- serve mcp or cortex serve mcpconfig.toml or env vars

cortex mcp is a query-only local child process mode for stdio MCP clients. It uses CORTEX_DB_PATH and logging variables, but does not require CORTEX_TOKEN and does not bind network ports.

Direct CLI commands such as cortex search, cortex tail, and cortex stats use the same query-only runtime and the same CORTEX_DB_PATH. Installed CLI commands automatically load $CORTEX_HOME/.env or ~/.cortex/.env when present, while explicit process environment variables still win. They are not MCP transports and do not use CORTEX_TOKEN.

Syslog listener

VariableRequiredDefaultDescriptionSensitive
CORTEX_RECEIVER_HOSTno0.0.0.0Listen host for UDP+TCP syslogno
CORTEX_RECEIVER_PORTno1514Listen port (shared UDP and TCP)no
CORTEX_MAX_MESSAGE_SIZEno8192Max message size in bytesno
CORTEX_BATCH_SIZEno100Entries per batch flushno
CORTEX_FLUSH_INTERVALno500Batch flush interval in msno
CORTEX_WRITE_CHANNEL_CAPACITYno10000Internal parsed-message queue capacityno

MCP server

VariableRequiredDefaultDescriptionSensitive
CORTEX_HOSTno0.0.0.0HTTP bind addressno
CORTEX_PORTno3100HTTP listen portno
CORTEX_TOKENno(none)Bearer token for /mcp. Generate: openssl rand -hex 32yes
CORTEX_ALLOWED_HOSTSno(none)Extra comma-separated Host header values for RMCP Host validationno
CORTEX_ALLOWED_ORIGINSno(none)Extra comma-separated browser origins for RMCP Origin validationno

Storage

VariableRequiredDefaultDescriptionSensitive
CORTEX_DB_PATHno/data/cortex.dbSQLite database file pathno
CORTEX_POOL_SIZEno8Connection pool size; reads get pool_size - 1 permitsno
CORTEX_SQLITE_PAGE_CACHE_MBno128Total SQLite page-cache budget across the poolno
CORTEX_SQLITE_MMAP_MBno256Bounded SQLite mmap size; resident mapped pages may still count toward cgroup memoryno
CORTEX_HEAVY_READ_CONCURRENCYno1Shared service-layer limiter for SQLite-heavy readsno
CORTEX_WAL_CHECKPOINT_MBno256WAL size threshold for bounded PASSIVE checkpoint attemptsno
CORTEX_RETENTION_DAYSno90Days before automatic purge (0 = forever)no

Storage budget

VariableRequiredDefaultDescriptionSensitive
CORTEX_MAX_DB_SIZE_MBno1024Soft DB size limit in MB (0 = disable)no
CORTEX_RECOVERY_DB_SIZE_MBno900Cleanup target after DB-size breachno
CORTEX_MIN_FREE_DISK_MBno0Min free disk in MB (0 = disable)no
CORTEX_RECOVERY_FREE_DISK_MBno0Recovery threshold after free-disk breach (0 = disabled with min-free guard)no
CORTEX_CLEANUP_INTERVAL_SECSno60Enforcement check interval in secondsno
CORTEX_CLEANUP_CHUNK_SIZEno2000Rows deleted per chunk (1 to 1,000,000)no

Docker log ingest

Current deployments use the host-local cortex agent, which streams Docker logs from each host's local Docker socket. The variables below are the legacy central pull compatibility mode for explicit remote Docker Engine HTTP endpoints.

VariableRequiredDefaultDescriptionSensitive
CORTEX_DOCKER_INGEST_ENABLEDnofalseEnable legacy central pull Docker log ingestion from remote Docker-compatible HTTP endpointsno
CORTEX_DOCKER_HOSTSyes, if Docker ingest is enabled(none)Comma-separated hostnames — each becomes http://<host>:2375 (e.g. squirts,tootie)no
CORTEX_DOCKER_RECONNECT_INITIAL_MSno1000Initial reconnect delay after host stream failureno
CORTEX_DOCKER_RECONNECT_MAX_MSno30000Maximum reconnect delay after repeated failuresno

Hosts specified via CORTEX_DOCKER_HOSTS default to plain http:// on port 2375 — use only on trusted private networks or behind firewall/TLS controls. Older setups may point these at docker-socket-proxy, but the deployed agent path is preferred.

Logging

VariableRequiredDefaultDescriptionSensitive
RUST_LOGnoinfoTracing filter directive (e.g. debug, cortex=trace)no

Docker / container

VariableRequiredDefaultDescriptionSensitive
CORTEX_UIDno1000Container user IDno
CORTEX_GIDno1000Container group IDno
CORTEX_FILE_TAIL_GROUPnoadmSupplementary container group for reading group-owned mounted log filesno
CORTEX_CONFIG_VOLUMEno./configRead-only config mount for optional config filesno
DOCKER_NETWORKnocortexExternal Docker network nameno

Token generation

openssl rand -hex 32

Store the result in CORTEX_TOKEN in your .env file.

See also

  • AUTH.md -- how tokens are used for authentication
  • TRANSPORT.md -- transport-specific variable usage
  • ../CONFIG.md -- full configuration reference with validation rules