Pingora is built to handle adverse network conditions gracefully: disconnects, timeouts, and malformed input are all expected events rather than exceptional ones. Rather than crashing, Pingora records these issues through its structured error logging layer. Understanding how to configure log output, tune log levels, and enrich error entries with per-request context is essential for operating a Pingora service in production.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/pingora/llms.txt
Use this file to discover all available pages before exploring further.
Log Output: File vs. STDERR
By default, Pingora writes log output to standard error (STDERR). When running in daemon mode (withdaemon: true in your configuration), you can redirect log output to a file by setting the error_log field in ServerConf:
error_log path must be writable by the process.
When
error_log is not set in the configuration — or when running in the foreground (non-daemon mode) — all log output goes to STDERR. This is the expected behaviour in containerised environments where the container runtime collects STDERR automatically.Log Levels
Pingora adopts the conventions of thelog crate. There are five levels, each with a distinct intended use:
| Level | Meaning |
|---|---|
error | The error prevents the current request from being handled correctly. For example: the upstream server is offline. |
warn | An error occurred but the system recovered. For example: the primary DNS query timed out but the secondary DNS responded successfully. |
info | Informational messages about the server lifecycle — startup, shutdown, and health events. |
debug | Internal implementation details useful during development. Not compiled into release builds. |
trace | Fine-grained internal details. Not compiled into release builds. |
Controlling the Active Level with RUST_LOG
Pingora respects the standardRUST_LOG environment variable. Set it before launching your binary to filter which log levels are emitted:
env_logger (or a compatible backend). The most common pattern in Pingora examples is:
Custom Request Summaries
Thepingora-proxy crate provides a well-defined interface for error logging so that you do not need to manually log common proxy errors — Pingora handles that automatically. Every time an error log entry is generated for a request, Pingora calls the request_summary callback to produce a summary string that is appended to the log line.
The default implementation delegates to the session’s built-in summary (method, path, Host header, and similar fields). You can override it on your ProxyHttp implementation to include any additional context that is valuable for debugging:
Suppressing Noisy Errors
Some errors are expected in normal operation — for example, clients that disconnect mid-request — and logging them aterror level produces noise that obscures real problems. Override suppress_error_log to return true for errors you want to silence:
suppress_proxy_warn_log, applies to retryable upstream failures and downstream errors that occur while a cache fill is in progress. Its signature is similar and it receives an additional ProxyWarnLogContext argument that identifies the specific warning scenario. This hook is marked experimental in the source and its API may change in a future release.
Suppressing errors removes the only per-request audit record for that failure path. If you suppress a class of errors, consider emitting a Prometheus counter or a structured log entry in the same override so that the failures remain observable in aggregate.
