Enable logging globally

Is it possible to write logs of everything, including requests that are not matched to any specific website or domain? I currently have a log output on each domain/site, but I would like to have something global and also see what kind of requests aren’t being matched.

Edit: To be more precise, I want the logs to be sent over the network (using the “output net” directive on logs, for example)

Hi Melissa–

Good question. All logs at the INFO level or higher are enabled by default, except for HTTP access logs, I think.

You can enable them 100% as described here in the docs: JSON Config Structure - Caddy Documentation

Enables access logging and configures how access logs are handled in this server. To minimally enable access logs, simply set this to a non-null, empty struct.

ServerLogConfig describes a server’s logging configuration. If enabled without customization, all requests to this server are logged to the default logger; logger destinations may be customized per-request-host.

I see, thanks! Is this something that’s also accessible via the Caddyfile right now?

Nope. JSON only!

1 Like

This would be really nice to have, I was also looking into a way to enable this via the Caddyfile

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