Change log format

Hello Caddy community, newbie here trying Caddy for the first time. Love the automated SSL cert setup, props to team for executing that flawlessly.

I need some help with the log file, syntax “log /home/caddy/website.log” works fine, but I’m trying to setup the combined log. I’ve tried every variation of “log path file [format]” but its not working,
if I use “log /home/caddy/ website.log “{combined}”” it just names the log file {combined}, can someone please explains and point me to the right syntax.

Thank you in advance.

Documentation is available here:
https://caddyserver.com/docs/log

An example:

log / access_log "{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}"

Hey, Thank you. This worked, the only issue is when I’m trying to add the file path for log, as mentioned in documentation I’ve tried
log /home/caddy/test/website.log “{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}”

and

log /home/caddy/test/ website.log "{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}"

as well as

log "/home/caddy/test/" "website.log" "{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}"

but none of these work, so the issue is with the file path, can you please provide me with the correct syntax to add log file path.

Cheers and thanks again

Did you try:

log / /home/caddy/test/website.log "{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}"

If path contains spaces you can put it inside double quotes as such:

log / "/home/caddy/test path/website.log" "{remote} | {user} | {when} | {method} | {uri} | {proto} | {status} | {size} | {latency} | {latency_ms}"

Yes, this fixed it, I was missing the / after log. Thank you a lot :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.