Globaly enabled access log, question again

In my searches I see this question around 2020 results… but I feel like enough time passed.

Caddyfile… would want to avoid boilerplate copy paste snippets in to every single block.
I am guessing its still not possible, but I wanted to ask.

Ive googled out some people writing that targeting port should work, but for me it did not. Should it work?

:443 {
   log {
      output file /var/log/caddy/caddy_access.log
   }
}

My plan is to use snippets to get logs going, they seem to work. I just liked how caddy unlike nginx so far avoided the boilerplate.

(log_common) {
	log {
		output file /var/log/caddy/caddy_access.log
	}
}

ntfy.example.com {
	import log_common
	reverse_proxy ntfy:80
}

There’s no implicit configuration in Caddy. You need to explicitly configure logging. Using snippets is a good way to avoid repetition :+1:

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