Another example how to use log_append for reverse proxy upstream details (#392)

Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
Steffen Busch 2024-10-11 16:30:24 +02:00 committed by GitHub
parent 13367a80ce
commit 6e893573fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,3 +37,21 @@ example.com {
} }
} }
``` ```
Display in the logs, which reverse proxy upstream was effectively used (either `node1`, `node2` or `node3`) and
the time spent proxying to the upstream in milliseconds as well as how long it took the proxy upstream to write the response header:
```caddy
example.com {
log
handle {
reverse_proxy node1:80 node2:80 node3:80 {
lb_policy random_choose 2
}
log_append upstream_host {rp.upstream.host}
log_append upstream_duration_ms {rp.upstream.duration_ms}
log_append upstream_latency_ms {rp.upstream.latency_ms}
}
}
```