Log reverse_proxy upstream

Good day,

How can I obtain information on especially which upstream(s) was dialed and typically the response times?
and the headers?
I thought I saw it in some caddylog, but currently can’t see it.

You can use the log directive to enable access logs:

To get more details about proxied requests, you can enable the debug global option which reveals some additional information:

Ah! Thank you, was using the JSON config, and it seems I have to include “http.handlers.reverse_proxy” to show that with the access_logs:

curl -s  http://localhost:2019/config/logging/logs/log0/ | jq .
{
  "encoder": {
    "format": "json"
  },
  "include": [
    "http.handlers.reverse_proxy",
    "http.log.access.log0"
  ],
  "level": "DEBUG",
  "writer": {
    "filename": "/var/log/caddy/caddy.log",
    "output": "file",
    "roll_keep": 30,
    "roll_keep_days": 14,
    "roll_size_mb": 10
  }
}

Is it possible, to (like the http.log.access. ) to name each upstream/dial/proxy separately?

You mean the log names? No, but since they’re structured you can just ignore the ones you don’t want.

Hmmm… okay, I also see that reverse_proxy only emit logs on DEBUG level.

the reason I’d like to have log names associated with an upstream, is that way I could easier group the various upstreams and their http access logs together in the same files for the clients, instead of now having to first filter for them the reverse_proxy.

This topic was automatically closed after 30 days. New replies are no longer allowed.