mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 12:36:16 -04:00
Use log_append for upstream details
This commit is contained in:
parent
ca9ce7b2b5
commit
b9237a5a81
1 changed files with 19 additions and 0 deletions
|
@ -37,3 +37,22 @@ example.com {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Display in the logs, which reverse proxy upstream was effectively used (either `node1:80`, `node2:80` or `node3:80`) 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 {
|
||||||
|
header_up Host {upstream_hostport}
|
||||||
|
lb_policy random_choose 2
|
||||||
|
}
|
||||||
|
log_append upstream-host "{http.reverse_proxy.upstream.host}"
|
||||||
|
log_append upstream-duration-ms "{http.reverse_proxy.upstream.duration_ms}"
|
||||||
|
log_append upstream-latency-ms "{http.reverse_proxy.upstream.latency_ms}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue