Simple instructions for getting CLF logging?

1. Output of caddy version:


2. How I run Caddy:

caddy run

a. System environment:



from: GitHub - caddyserver/transform-encoder: Log encoder module for custom log formats

    log {   
            format transform "{common_log}"
            output file /var/log/caddy.log

3. The problem I’m having:

I am trying to make heads or tails out of caddy documentation to generate easily human readable CLF logfile output from Caddy. But i get nowhere:


CLF clashes with modern structured logs. To transform your access logs into the deprecated Common Log Format, please use the transform-encoder plugin.

But then the URL for the transform-encode plugin does not tell me how to install the transform plugin. And i could not find another doc page that tells me how to install a plugin… except stuff that looks like i need to compile plugins first ? That would be weird if true. And somewhat disappointing that caddy would make it so hard to use plugins that it claims to have in its documentation.

4. Error messages and/or full log output:

caddy run
2022/08/29 15:32:48.818 INFO    using adjacent Caddyfile
run: adapting config using caddyfile: parsing caddyfile tokens for 'log': Caddyfile:16 - Error during parsing: getting module named 'caddy.logging.encoders.transform': module not registered: caddy.logging.encoders.transform

You need to get a build of Caddy with that plugin compiled in.

There’s a few ways you can do this. See the docs, they explain.

I am sorry, but if there was a simple way to get caddy with the transform plugin, then it should be possible to point me to a URL explaining it. I looked through all the caddy documentation, and i could not find it.

The only thing i could find was:

install golang
install xcaddy

try to build caddy with plugin:

xcaddy build --with

Which gives some error (ambiguous stuff) ambiguous import: found package in multiple modules: v0.0.0-20200503195918-621b933c7a7f (/root/go/pkg/mod/ v0.0.0-20220418222510-f25a4f6275ed (/root/go/pkg/mod/!go/antlr@v0.0.0-20220418222510-f25a4f6275ed)

I try to resolve the error by say --with one of those versions. Does not help.

I try “xcaddy build” without the module. Gives other errors.

/root/go/pkg/mod/ package embed is not in GOROOT (/usr/lib/go-1.15/src/embed)
/root/go/pkg/mod/ package io/fs is not in GOROOT (/usr/lib/go-1.15/src/io/fs)

Aka: I would need to become an expert how to compile caddy with xcaddy and learn how to resolve all type of compile issues of a complex piece of software.

Not really. The error you’re reporting indicates you either have an old Go version or an old xcaddy version because we’ve fixed that issue earlier. If you had reported the errors, the version of Go installed on your system, and perhaps xcaddy version, we could’ve immediately told you to upgrade both of them. The link of the GitHub repository does contain instructions, which you seem to have found later.

Anyways, you can use the download page on website to receive a custom-built executable with all the desired modules built into it. The transform-encoder is listed there.


Hmm. all of caddy, xcaddy was installed in the last 7 days using the instructions from caddys documentation on debian 11. So i’ve got no idea how i could update that further.

Thanks a lot for the pointer. Will try. It is not listed on the caddy documentation web page. I remember i stumbled once across it, but i have to admit i did not manage to figure out that you needed to click into the white-space of modules to select plugins to be added. Not really unintuitive but unexpected. Hadn’t seen that type of user interface in before in software download.

1 Like

The latest version of xcaddy is v0.3.1, you can check by running xcaddy version.

Make sure you have at least Go 1.18, check by running go version. You OS’s package repos may have an outdated version, so you should download it from the Go website (you just need to unpack it somewhere, then update your PATH to include it). Or use a tool like GitHub - udhos/update-golang: update-golang is a script to easily fetch and install new Golang releases with minimum system intrusion which can automate installing and updating your version of Go.

There’s a bunch of UI hints that imply it’s clickable. First, hovering makes it grow, and the cursor changes to a hand :point_up_2: and there’s a little mention that implies you can choose plugins. Really not sure what else we can do here, I think it’s super obvious.

1 Like

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