Help with replacing common_log format

Current Caddyfile.
Caddy Version 2.4.6

I’m quite confused trying to figure out how to switch to this new formatting plugin. The syntax is different than what I’m used to. If someone could help me switch I’d appreciate it as I use this common log to hook into my fail2ban setup.

{
email dubu@bub.cat
acme_ca https://acme.zerossl.com/v2/DV90
}

www.a.bub.cat {
redir https://a.bub.cat
}

a.bub.cat {
reverse_proxy localhost:50694
log {
output file /var/log/caddy/void.log
format single_field common_log
}
encode {
gzip 6
br 5
}
import security.conf
handle_errors {
rewrite * /{http.error.status_code}
reverse_proxy https://http.cat {
header_up Host http.cat
}
}
}

1 Like

Assuming you have a caddy build with GitHub - caddyserver/transform-encoder: Log encoder module for custom log formats included, you can do the following:

    log {
        output file /var/log/caddy/void.log
-       format single_field common_log
+       format transform "{common_log}"
    }

Taken from the modules’ README: transform-encoder#apache-common-log-format-example [permalink]

2 Likes

You should use that plugin with v2.5.0-beta.1, it’s meant to be used with that version (or later), not with v2.4.6

2 Likes

Hey thanks a lot guys. It’s working now. Appreciate the help!

2 Likes

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