log-sidecar-redis #

Bash daemon that polls Redis diagnostics every 5 seconds and publishes notable operational events to the logs.redis.* fanout bus.

Implements Phase 2 of protocol/redis-log-fanout v0.1 (TOD-519): service-external signals that never flow through the reveried tracing layer. Envelope shape matches RedisFanoutv, ts, service, host, level, pid, target, msg, fields — so consumers can treat sidecar messages and in-process tracing events identically.

What it watches #

SignalSourceChannelThreshold
New SLOWLOG entriesSLOWLOG GET 10logs.redis.warnany entry with id > last-seen
Client count deltaINFO clientslogs.redis.infoabs(delta) > 5 between polls
Memory pressureINFO memorylogs.redis.warnused_memory_rss > 0.9 * maxmemory

Every event is also XADD’d to logs:stream:redis with MAXLEN ~ 10000, mirroring the in-process fanout layer.

Running #

scripts/log-sidecar-redis                     # uses local redis-cli defaults
REDIS_URL=redis://host:6379 scripts/log-sidecar-redis
POLL_INTERVAL=10 scripts/log-sidecar-redis    # slower cadence
LOG_SIDECAR_DISABLED=1 scripts/log-sidecar-redis   # no-op exit

The sidecar is intentionally a single Bash file so it can run on any host with redis-cli + python3 (or jq) installed, no Rust toolchain required. Typical deployment is as a sibling process to reveried under systemd / supervisord.

Resilience #

Smoke #

With slowlog-log-slower-than 0 (to force entries), run the sidecar for ~10s and issue a few redis-cli PINGs — XLEN logs:stream:redis must be ≥ 1 and each entry must parse as the v0.1 envelope shape. LOG_SIDECAR_DISABLED=1 must short-circuit to exit 0. Pointing REDIS_URL at a dead port must produce visible exponential backoff lines without crashing.