1. Caddy version (2.10.2):
2. The problem I am having:
Hi guys, I am currently writing a new plugin which check the POST payloads, and I want to record some certain fields in the data payload, for example, the “method“ field of the POST request. I was trying to set the wanted value in the http.context and using ‘format append’ feature to append this field to the access log.
The code is like:
caddyhttp.SetVar(r.Context(), "method", data["method"])
and my Caddyfile looks like:
log {
level info
output file access.log {
roll_size 10MB
roll_keep 5
roll_keep_for 168h
}
format append {
fields {
method {http.vars.method}
}
wrap json
}
}
However, the access.log indeed has this method field, but no matter how I tried adding values, this field is always NULL in the log.
I noticed that the caddy doc says that it supports only global placeholders (e.g. {env.*} ), as shown in the picture:
So does it mean that we are unable to append such information into the access log? Is there any way that I can realize this requirement?
Thanks in advance!
