webserver

caddy logline for combined log format

Posted on Updated on

You can use this log line to get the “Combined Log Format” in caddy.

log / stdout “{remote} – – [{when}] \”{method} {path} {proto}\” {status} {size} \”{>Referer}\” \”{>User-agent}\””

or the predefined format “{combined}”

The placeholders are described at https://caddyserver.com/docs/placeholders and the log directive at https://caddyserver.com/docs/log

In case that you are behind a reverves proxy or loadbalancer you will need also to add this directive to the caddy file, to get the real ip.

realip {
from 10.0.0.0/8
}

Of course you will change the from part 😉
The realip directive is described at https://caddyserver.com/docs/realip

Advertisements