Why is json setup so difficult?

1. Output of caddy version:

2. How I run Caddy:

a. System environment:

b. Command:

Paste command here.

curl “http://localhost:2019/load” -H “Content-Type: application/json” -d @caddy.json

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

{
“logging”: {
“logs”: {
“”: {
“writer”: {
“stdout”: {
“output”: “stdout”
},
“stderr”: {
“output”: “stderr”
}
}
}
}
},
}

Paste your config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.

3. The problem I’m having:

I can’t understand the json config

4. Error messages and/or full log output:

Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

{“error”:“loading config: loading new config: setting up custom log ‘’: loading log writer module: module name not specified with key ‘output’ in map[stderr:map[output:stderr] stdout:map[output:stdout]]”}

5. What I already tried:

root@test:~/application# journalctl -u caddy.service -f --output cat

{“level”:“info”,“ts”:1677039993.7283962,“logger”:“tls.cache.maintenance”,“msg”:“started background certificate maintenance”,“cache”:“0xc00043b420”}

2023-02-22 04:26:33.728396337 +0000 UTC m=+16.059547109 write error: error getting log file info: stat /root/log/caddy.log: permission denied

{“level”:“info”,“ts”:1677039993.7291415,“logger”:“http.log”,“msg”:“server running”,“name”:“front”,“protocols”:[“h1”,“h2”,“h3”]}

2023-02-22 04:26:33.729141377 +0000 UTC m=+16.060292159 write error: error getting log file info: stat /root/log/caddy.log: permission denied

{“level”:“info”,“ts”:1677039993.729247,“logger”:“tls.cache.maintenance”,“msg”:“stopped background certificate maintenance”,“cache”:“0xc0003a0690”}

{“level”:“info”,“ts”:1677039993.729362,“msg”:“autosaved config (load with --resume flag)”,“file”:“/var/lib/caddy/.config/caddy/autosave.json”}

{“level”:“info”,“ts”:1677039993.7294462,“logger”:“admin.api”,“msg”:“load complete”}

{“level”:“info”,“ts”:1677039993.7326043,“logger”:“admin”,“msg”:“stopped previous server”,“address”:“localhost:2019”}

{“level”:“error”,“ts”:1677039997.7891026,“logger”:“http.handlers.reverse_proxy”,“msg”:“aborting with incomplete response”,“error”:“write tcp 158.247.219.96:80->162.158.170.85:11744: write: broken pipe”}

2023-02-22 04:26:37.789102665 +0000 UTC m=+20.120253448 write error: error getting log file info: stat /root/log/caddy.log: permission denied

6. Links to relevant resources:

You can use caddy adapt to change a Caddyfile to json, documentation will help you to understand how json config is structured. I’m using a phone right now, so I can’t really tell you what’s wrong the config.

1 Like

I’d also recommend looking at the crash course style wiki post done by Matt Holt:

2 Likes

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