How to set up logging in caddyfile

1. The problem I’m having:

I have set up caddy reverse proxy for my jellyfin server and after opening port 443 in my router and setting up the config file I can reach jellyfin from outside of my network. What I want to do is have some sort of logging file configured in the caddyfile so I can see if something fishy is going on.

2. Error messages and/or full log output:

nothing to see here..


3. Caddy version:

╭─pi@raspberrypi /home/pi ‹system›
╰─$ caddy version
2.6.2

4. How I installed and ran Caddy:

I installed it using apt (raspberrypios trixie) and run it with systemd

a. System environment:

raspberry pi 4b running raspberrypios trixie

b. Command:

systemd service


c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

larijani.ddns.net {
        reverse_proxy localhost:8096
}

5. Links to relevant resources:

In this case it should be

larijani.ddns.net {

reverse_proxy localhost:8096

log {

    output file /var/log/caddy/jellyfin-access.log {

        roll_size 10MiB

        roll_keep 10

        roll_keep_for 720h

    }

    format json

}

}

For example you should get log from that path or your own path

sudo mkdir -p /var/log/caddy

sudo chown caddy:caddy /var/log/caddy

sudo systemctl reload caddy

Hope i help

And you need update your caddy to 2.11.2