Configuration

Sentinel uses KDL (a human-friendly document language) for configuration. This section covers all configuration options organized by component.

Configuration Blocks

BlockPurpose
File FormatKDL syntax and file structure
ServerWorker threads, process management, shutdown
ListenersNetwork binding, TLS, SNI, HTTP/2
RoutesRequest matching and routing rules
UpstreamsBackend pools, load balancing, health checks
LimitsRequest limits, rate limiting, memory protection
FiltersRate limiting, CORS, compression, geo-blocking
CachingHTTP response caching configuration
ObservabilityLogging, metrics, and distributed tracing
AgentsExternal processing agent configuration

Quick Example

server {
    worker-threads 0
    max-connections 10000
    trace-id-format "tinyflake"
}

listeners {
    listener "https" {
        address "0.0.0.0:443"
        protocol "https"
        tls {
            cert-file "/etc/sentinel/certs/server.crt"
            key-file "/etc/sentinel/certs/server.key"
            min-version "1.2"
        }
    }
}

routes {
    route "api" {
        priority 100
        matches {
            path-prefix "/api/"
        }
        upstream "backend"
        filters "rate-limit" "cors"

        cache {
            enabled #true
            default-ttl-secs 60
        }
    }
}

upstreams {
    upstream "backend" {
        targets {
            target { address "10.0.1.1:8080" }
            target { address "10.0.1.2:8080" }
        }
        load-balancing "round_robin"
        health-check {
            type "http" {
                path "/health"
                expected-status 200
            }
        }
    }
}

filters {
    filter "rate-limit" {
        type "rate-limit"
        max-rps 100
        burst 20
        key "client-ip"
    }

    filter "cors" {
        type "cors"
        allowed-origins "https://example.com"
        allowed-methods "GET" "POST" "PUT" "DELETE"
    }
}

cache {
    enabled #true
    backend "memory"
    max-size 104857600
}

observability {
    logging {
        level "info"
        format "json"
    }
    metrics {
        enabled #true
        address "0.0.0.0:9090"
    }
}

limits {
    max-body-size-bytes 10485760
}

Validation

Always validate configuration before applying:

sentinel --config sentinel.kdl --validate

Hot Reload

Reload configuration without restart:

kill -HUP $(cat /var/run/sentinel.pid)
# or
curl -X POST http://localhost:9090/admin/reload