151 lines
6.6 KiB
TOML
151 lines
6.6 KiB
TOML
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||
|
|
# VEZA — Centralized Logging Configuration
|
||
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||
|
|
#
|
||
|
|
# Single source of truth for ALL service logging.
|
||
|
|
# Read by: Go backend, Rust stream server, Frontend (via env vars)
|
||
|
|
#
|
||
|
|
# Override any value via environment variable:
|
||
|
|
# LOG_LEVEL=DEBUG LOG_DIR=/tmp/veza-logs make dev
|
||
|
|
#
|
||
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||
|
|
|
||
|
|
# ── Global defaults ──────────────────────────────────────────────────────────
|
||
|
|
|
||
|
|
[global]
|
||
|
|
# Log level: TRACE, DEBUG, INFO, WARN, ERROR (case-insensitive, Go & Rust compatible)
|
||
|
|
level = "INFO"
|
||
|
|
|
||
|
|
# Base directory for all log files
|
||
|
|
# Created automatically with 0755 permissions if it doesn't exist.
|
||
|
|
# Fallback: ./logs (if /var/log/veza is not writable)
|
||
|
|
dir = "/var/log/veza"
|
||
|
|
|
||
|
|
# Format: "json" (production/staging) or "text" (development)
|
||
|
|
# Auto-detected from APP_ENV if not set: production/staging → json, else → text
|
||
|
|
format = "auto"
|
||
|
|
|
||
|
|
# ── File rotation (lumberjack for Go, tracing-appender for Rust) ─────────────
|
||
|
|
|
||
|
|
[rotation]
|
||
|
|
# Maximum size of a single log file before rotation (megabytes)
|
||
|
|
max_size_mb = 100
|
||
|
|
|
||
|
|
# Maximum number of rotated files to retain
|
||
|
|
max_backups = 10
|
||
|
|
|
||
|
|
# Maximum age of rotated files before deletion (days)
|
||
|
|
max_age_days = 30
|
||
|
|
|
||
|
|
# Compress rotated files with gzip
|
||
|
|
compress = true
|
||
|
|
|
||
|
|
# Rust rotation strategy: "hourly" or "daily"
|
||
|
|
# Hourly if max_size_mb ≤ 100, daily otherwise
|
||
|
|
rust_rotation = "hourly"
|
||
|
|
|
||
|
|
# Maximum rotated files for Rust (tracing-appender)
|
||
|
|
rust_max_files = 5
|
||
|
|
|
||
|
|
# ── Go Backend API ───────────────────────────────────────────────────────────
|
||
|
|
|
||
|
|
[backend]
|
||
|
|
# Module name — determines log file names: {module}.log, {module}-error.log
|
||
|
|
module = "backend-api"
|
||
|
|
|
||
|
|
# Additional module loggers (each gets its own .log + -error.log pair)
|
||
|
|
# These log database queries, redis commands, rabbitmq events separately
|
||
|
|
modules = ["db", "rabbitmq"]
|
||
|
|
|
||
|
|
# Slow request detection threshold (milliseconds)
|
||
|
|
# Requests slower than this are logged at WARN level
|
||
|
|
slow_request_threshold_ms = 1000
|
||
|
|
|
||
|
|
# Sampling (production only — prevents log spam under high load)
|
||
|
|
# Initial: first N messages per second are always logged
|
||
|
|
# Thereafter: 1 in N subsequent messages are logged
|
||
|
|
sampling_initial = 100
|
||
|
|
sampling_thereafter = 100
|
||
|
|
|
||
|
|
# Async buffered writes
|
||
|
|
# Buffer size in KB — reduces syscalls by batching writes
|
||
|
|
buffer_size_kb = 256
|
||
|
|
|
||
|
|
# Flush interval in milliseconds — maximum delay before buffer is flushed
|
||
|
|
flush_interval_ms = 100
|
||
|
|
|
||
|
|
# ── Rust Stream Server ───────────────────────────────────────────────────────
|
||
|
|
|
||
|
|
[stream]
|
||
|
|
# Module name — determines log file prefix: {module}.YYYY-MM-DD-HH
|
||
|
|
module = "stream"
|
||
|
|
|
||
|
|
# Include source file and line number in log entries
|
||
|
|
include_source = true
|
||
|
|
|
||
|
|
# Include thread IDs in log entries
|
||
|
|
include_thread_ids = true
|
||
|
|
|
||
|
|
# ── Frontend (React) ────────────────────────────────────────────────────────
|
||
|
|
|
||
|
|
[frontend]
|
||
|
|
# Frontend log level (VITE_LOG_LEVEL)
|
||
|
|
# Defaults: DEBUG in development, WARN in production
|
||
|
|
level = "auto"
|
||
|
|
|
||
|
|
# Backend endpoint for forwarding frontend errors
|
||
|
|
# Uses navigator.sendBeacon() for non-blocking delivery
|
||
|
|
endpoint = "/api/v1/logs/frontend"
|
||
|
|
|
||
|
|
# Enable Sentry error tracking (requires VITE_SENTRY_DSN env var)
|
||
|
|
sentry_enabled = false
|
||
|
|
|
||
|
|
# ── Log Aggregation (optional — Loki/Grafana) ───────────────────────────────
|
||
|
|
|
||
|
|
[aggregation]
|
||
|
|
# Enable centralized log aggregation (Loki-compatible)
|
||
|
|
enabled = false
|
||
|
|
|
||
|
|
# Aggregation endpoint URL
|
||
|
|
# endpoint = "http://loki:3100/loki/api/v1/push"
|
||
|
|
|
||
|
|
# Batch size — number of log entries per HTTP push
|
||
|
|
batch_size = 100
|
||
|
|
|
||
|
|
# Flush interval (seconds) — maximum delay between pushes
|
||
|
|
flush_interval_s = 5
|
||
|
|
|
||
|
|
# HTTP timeout for push requests (seconds)
|
||
|
|
timeout_s = 10
|
||
|
|
|
||
|
|
# Static labels applied to all log entries
|
||
|
|
# labels = "app=veza,env=production"
|
||
|
|
|
||
|
|
# ── File permissions ─────────────────────────────────────────────────────────
|
||
|
|
|
||
|
|
[permissions]
|
||
|
|
# Directory permissions (octal)
|
||
|
|
dir_mode = "0755"
|
||
|
|
|
||
|
|
# File permissions (octal) — Go files
|
||
|
|
file_mode = "0640"
|
||
|
|
|
||
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||
|
|
# Environment Variable Overrides (highest priority)
|
||
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|
||
|
|
#
|
||
|
|
# LOG_LEVEL → global.level
|
||
|
|
# LOG_DIR → global.dir
|
||
|
|
# LOG_FORMAT → global.format
|
||
|
|
# SLOW_REQUEST_THRESHOLD_MS → backend.slow_request_threshold_ms
|
||
|
|
# LOG_AGGREGATION_ENABLED → aggregation.enabled
|
||
|
|
# LOG_AGGREGATION_ENDPOINT → aggregation.endpoint
|
||
|
|
# LOG_AGGREGATION_BATCH_SIZE → aggregation.batch_size
|
||
|
|
# LOG_AGGREGATION_FLUSH_INTERVAL → aggregation.flush_interval_s
|
||
|
|
# LOG_AGGREGATION_TIMEOUT → aggregation.timeout_s
|
||
|
|
# LOG_AGGREGATION_LABELS → aggregation.labels
|
||
|
|
# VITE_LOG_LEVEL → frontend.level
|
||
|
|
# VITE_SENTRY_DSN → frontend.sentry_enabled (if set)
|
||
|
|
#
|
||
|
|
# ═══════════════════════════════════════════════════════════════════════════════
|