Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
233 lines (192 loc) · 11.7 KB
/
Copy path.env.example
File metadata and controls
233 lines (192 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# ─────────────────────────────────────────────────────────────────────────────
# raglogs — environment configuration
# Copy this file to .env and fill in your values.
# All variables are optional unless marked REQUIRED.
# ─────────────────────────────────────────────────────────────────────────────
# ── Database ──────────────────────────────────────────────────────────────────
# [REQUIRED] PostgreSQL connection string with pgvector extension.
# Driver must be psycopg (v3), not psycopg2.
DB_URL=postgresql+psycopg://postgres:postgres@localhost:5432/raglogs
# Docker Compose default (already set in docker-compose.yml, override here
# only if you're pointing at an external database):
# DB_URL=postgresql+psycopg://postgres:postgres@postgres:5432/raglogs
# Connection pool. Sync API routes run on FastAPI's threadpool (40 threads by
# default), so keep pool_size + max_overflow in that ballpark or concurrent
# requests block on checkout and time out. Defaults give 40 connections.
# DB_POOL_SIZE=20
# DB_MAX_OVERFLOW=20
# ── LLM provider ─────────────────────────────────────────────────────────────
# Controls the explain and ask commands.
# Options: disabled | openai | ollama | claude
# Default: disabled (deterministic rules-based output, no API calls)
LLM_PROVIDER=disabled
# Model to use when LLM_PROVIDER is openai, ollama, or claude.
# OpenAI examples : gpt-4.1-mini gpt-4.1 gpt-4o
# Ollama examples : llama3 mistral phi3
# Claude examples : claude-haiku-4-5 (recommended default for LLM_PROVIDER=claude)
LLM_MODEL=gpt-4.1-mini
# API key and base URL for OpenAI (used when LLM_PROVIDER=openai or EMBEDDINGS_PROVIDER=openai).
OPENAI_API_KEY=
OPENAI_BASE_URL=https://api.openai.com/v1
# When LLM_PROVIDER=ollama, set the Ollama server URL.
OLLAMA_BASE_URL=http://localhost:11434
# When LLM_PROVIDER=claude, set the Anthropic API key. Empty key falls back to
# the noop (template) provider. Override the endpoint only for proxies.
# LLM_MODEL=claude-haiku-4-5
ANTHROPIC_API_KEY=
ANTHROPIC_BASE_URL=https://api.anthropic.com
# ── Embeddings provider ───────────────────────────────────────────────────────
# Controls semantic cluster merging at analysis time (explain / clusters /
# timeline / compare), semantic `ask` over stored pgvector embeddings, and
# similar-incident search over cluster_embeddings.
# Options: disabled | openai | local
# Default: disabled — fingerprint-only clustering; ask uses keyword retrieval;
# similar uses fingerprint equality
EMBEDDINGS_PROVIDER=disabled
# Embedding model (used when provider is openai or local).
# OpenAI: text-embedding-3-small
# Local: a sentence-transformers model name (requires raglogs[local-embeddings]).
# IMPORTANT: the stored embedding column is Vector(1536), so a local
# model MUST emit exactly 1536 dims. The popular models do NOT
# (all-MiniLM-L6-v2 = 384, all-mpnet-base-v2 = 768) and are rejected
# rather than silently producing no embeddings (see EMBEDDINGS_DIMENSIONS
# below for exactly how). Use OpenAI or disabled unless you have a
# 1536-dim local model. Note: provider=local loads the model at startup
# and before ingest, which may download it on first use.
EMBEDDINGS_MODEL=text-embedding-3-small
# Embedding vector dimensions — must match the model output AND the stored
# log_embeddings column (Vector(1536)). Any value other than 1536 with a
# non-disabled provider is a configuration error (nothing could be persisted).
# It is surfaced, not silent: `ingest --with-embeddings` hard-exits with an
# actionable message, and API startup logs it at `error` and keeps serving the
# non-embedding features. text-embedding-3-small = 1536, text-embedding-3-large = 3072.
EMBEDDINGS_DIMENSIONS=1536
# Merge fingerprint clusters whose representative messages have cosine
# similarity >= this threshold. Conservative default: safer to under-merge
# than to collapse distinct errors. Ignored when EMBEDDINGS_PROVIDER=disabled.
CLUSTER_MERGE_SIMILARITY_THRESHOLD=0.92
# Minimum cluster count to participate in a merge. 1 = singletons may merge.
CLUSTER_MERGE_MIN_COUNT=1
# Semantic ask (pgvector over log_embeddings). Looser than cluster-merge
# because questions paraphrase. Ignored when embeddings are missing/disabled;
# ask then falls back to keyword search.
ASK_SEMANTIC_TOP_K=100
ASK_SEMANTIC_MIN_SIMILARITY=0.75
# Similar-incident search (pgvector over cluster_embeddings). Falls back to
# exact fingerprint matching when the provider is down or no vectors exist.
SIMILAR_SEMANTIC_MIN_SIMILARITY=0.80
# ── Analysis tuning ───────────────────────────────────────────────────────────
# Baseline comparison window for the explain command.
# Format: <number><unit> where unit is s/m/h/d (e.g. 24h, 2d, 1h)
DEFAULT_BASELINE_WINDOW=24h
# Maximum number of evidence bullet points in an incident summary.
MAX_EVIDENCE_ITEMS=8
# Maximum number of clusters fed into the explain pipeline.
# Higher = more thorough but slower for large ingestions.
MAX_CLUSTERS_FOR_EXPLAIN=10
# How many minutes before window_start to search for trigger candidates
# (deploys, restarts, config changes). The search filters to trigger-shaped
# rows in SQL before ordering/capping, so widening this to catch slow-burn
# triggers does not cost recall on a busy scope — it only widens the time
# range searched for actual trigger phrasing, not for log volume generally.
TRIGGER_LOOKBACK_MINUTES=10
# ── Worker ────────────────────────────────────────────────────────────────────
# ── HTTP API auth ─────────────────────────────────────────────────────────────
# Default AUTH_ENABLED=false so local demo and unit tests stay open.
# Production and Docker Compose hosts that bind 0.0.0.0 should set AUTH_ENABLED=true.
# AUTH_ENABLED=false
# AUTH_MODE=api_key # api_key | oidc | both
# OIDC_ISSUER=
# OIDC_AUDIENCE=
# OIDC_JWKS_URL=
# API_BIND_HOST=127.0.0.1
# AUTH_REFUSE_INSECURE_BIND=false
# Seconds the worker sleeps between polling for new jobs when the queue is empty.
WORKER_POLL_INTERVAL=2
# Ingest queue backpressure. POST /v1/ingestions and POST /v1/ingestions/lines
# return 429 INGEST_QUEUE_FULL + Retry-After when pending worker jobs >= max.
# Tail ticks skip the same ceiling. Distinct from RATE_LIMITED (token bucket).
INGEST_QUEUE_MAX=100
INGEST_RETRY_AFTER_SECONDS=5
# API token-bucket rate limiting (ingest writes + query routes). In-memory per
# process. 0 rps = unlimited for that category. Defaults are high so local demo
# and tests are not 429'd. Identity is API key id, or "anonymous" when auth is off.
# RATELIMIT_ENABLED=true
# RATELIMIT_INGEST_RPS=100
# RATELIMIT_QUERY_RPS=100
# RATELIMIT_BURST=100
# RATELIMIT_RETRY_AFTER_SECONDS=1
# Max in-flight LLM provider calls (process-wide; independent of API concurrency).
# 0 = unlimited. Noop provider skips the wait.
# LLM_MAX_CONCURRENCY=4
# LLM resilience (timeout, retries, token ceiling, circuit breaker). Unused when
# LLM_PROVIDER=disabled (noop). On timeout/error/open breaker, explain/ask fall
# back to deterministic templates and set llm.fell_back=true; the request succeeds.
# LLM_TIMEOUT=30
# LLM_MAX_RETRIES=2 # extra attempts after the first (3 total)
# LLM_MAX_TOKENS=600 # completion cap (OpenAI/Claude max_tokens / Ollama num_predict)
# LLM_MAX_INPUT_TOKENS=0 # 0 = derive from LLM_MAX_TOKENS (chars/4 estimate)
# LLM_BREAKER_THRESHOLD=5 # consecutive failures before the breaker opens
# LLM_BREAKER_COOLDOWN_SECONDS=60
# Max NDJSON lines accepted by POST /v1/ingestions/lines (over cap → 400).
INGEST_PUSH_MAX_LINES=5000
# Tail-mode poll cadence and consecutive-error auto-pause.
TAIL_POLL_INTERVAL=30
TAIL_ERROR_THRESHOLD=5
# HMAC-signed ingest completion callbacks (optional callback_url on POST /v1/ingestions).
# Per-key secrets (whsec_…) are minted with `raglogs keys create` and used when the
# request was authenticated with that API key. WEBHOOK_SECRET is the fallback when
# AUTH_ENABLED=false or the key has no stored signing secret (legacy keys).
# WEBHOOK_SECRET=
# WEBHOOK_MAX_RETRIES=5
# WEBHOOK_TIMEOUT=10
# Idempotency-Key TTL for POST /v1/ingestions (batch enqueue and tail create).
# Repeat requests with the same key within this window return the original job.
# INGEST_IDEMPOTENCY_TTL_SECONDS=86400
# Data retention (G13). Duration strings (30d, 180d, 24h). 0, empty, or off
# disables that tier. Per-scope overrides: INSERT INTO scope_retention
# (scope, raw_interval, summary_interval) VALUES ('incident:prod', '7d', '90d');
# NULL column = use the env default below. The worker enqueues a purge job on
# idle poll every PURGE_INTERVAL_SECONDS (or run `raglogs purge` / `--dry-run`).
RETENTION_RAW=30d
RETENTION_SUMMARY=180d
PURGE_INTERVAL_SECONDS=3600
# PURGE_CHUNK_SIZE=1000
# Self-observability (structured JSON logs, Prometheus /metrics, optional OTLP).
# LOG_FORMAT=json|console (API defaults to json; CLI uses console on a TTY)
# OTEL_SDK_DISABLED=true skips the OpenTelemetry SDK (request ids still generated).
# OTEL_EXPORTER_OTLP_ENDPOINT= # empty = no exporter; tests/demo need no collector
# OTEL_SERVICE_NAME=raglogs
# ── Adapters ──────────────────────────────────────────────────────────────────
# AWS region for the cloudwatch source adapter (raglogs ingest --adapter cloudwatch).
# Credentials come from the standard AWS credential chain (env vars, shared config,
# IRSA in-cluster) — never set an access key here.
ADAPTER_CLOUDWATCH_REGION=us-east-1
# Grafana Loki source adapter (raglogs ingest --adapter loki).
# URL is required for /health to report the adapter as available. Auth is optional
# (open Loki) — use Bearer *or* basic, not both. Tenant sets X-Scope-OrgID
# (Grafana Cloud / multi-tenant Loki). Default query is used when ingest params
# omit `query`.
# LOKI_URL=http://localhost:3100
# LOKI_TENANT=
# LOKI_BEARER_TOKEN=
# LOKI_USERNAME=
# LOKI_PASSWORD=
# LOKI_QUERY={job=~".+"}
# Datadog Logs Search API (raglogs ingest --adapter datadog). Both keys are required;
# the application key needs logs_read_data. Site is the Datadog site hostname
# (datadoghq.com, us3.datadoghq.com, datadoghq.eu, ...). page_size max is 1000
# (Datadog API limit). max_rows caps how many events one ingest run will pull.
DATADOG_API_KEY=
DATADOG_APP_KEY=
DATADOG_SITE=datadoghq.com
DATADOG_PAGE_SIZE=1000
DATADOG_MAX_ROWS=10000
# ── Cluster severity weights ──────────────────────────────────────────────────
# These control how clusters are ranked by importance.
# Raise a weight to surface that level more prominently in summaries.
SEVERITY_WEIGHT_FATAL=5.0
SEVERITY_WEIGHT_ERROR=4.0
SEVERITY_WEIGHT_WARN=3.0
SEVERITY_WEIGHT_INFO=1.0
SEVERITY_WEIGHT_DEBUG=0.5