Minimise Caddy Logging

Posted on .

I've been moving stuff to my new home server and been setting up services with Caddy. It has been a breath of fresh air after my messy Nginx configurations and Let's Encrypt setup. But I found the default logs to contain waaay more information than I needed. So here's a snippet to configure logging to stdout (for Systemd's journald) and remove some extraneous stuff that I don't need to see:

(logging) {
  log {
    output stdout
    format filter {
      wrap console
      fields {
        request>headers delete
        request>tls delete
        request>remote_port delete
        resp_headers delete
        bytes_read delete
        user_id delete
} {
  # Use the above log setup
  import logging