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:
says:
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
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.
github.com/antlr/antlr4/runtime/Go/antlr: ambiguous import: found package github.com/antlr/antlr4/runtime/Go/antlr in multiple modules:
github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f (/root/go/pkg/mod/github.com/antlr/antlr4@v0.0.0-20200503195918-621b933c7a7f/runtime/Go/antlr)
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220418222510-f25a4f6275ed (/root/go/pkg/mod/github.com/antlr/antlr4/runtime/!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/github.com/caddyserver/caddy/v2@v2.5.2/modules/caddyhttp/fileserver/browse.go:19:2: package embed is not in GOROOT (/usr/lib/go-1.15/src/embed)
/root/go/pkg/mod/github.com/caddyserver/certmagic@v0.16.1/account.go:28:2: 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 caddyserver.com 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 caddyserver.com 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.
There’s a bunch of UI hints that imply it’s clickable. First, hovering makes it grow, and the cursor changes to a hand 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.