You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caddy always emits a log to http.log.error when the error directive is used. I would like to ignore specific errors like error 404 and error 403, for example. It appears that log_skip and log_name only work for access logs (i.e. http.log.access), not for error logs (i.e. http.log.error). To be clear, I still want DEBUG level logs for http.log.error (because things like bad Go templates emit DEBUG level errors), but I don't want 404 errors.
Proposed Solution
Ideally, I'd like to add something to my error_handler like:
Opening issue per @francislavoie here: https://caddy.community/t/suppress-logging-for-http-errors-raised-via-error-directive/25959
Problem
Caddy always emits a log to
http.log.error
when theerror
directive is used. I would like to ignore specific errors likeerror 404
anderror 403
, for example. It appears thatlog_skip
andlog_name
only work for access logs (i.e.http.log.access
), not for error logs (i.e.http.log.error
). To be clear, I still want DEBUG level logs forhttp.log.error
(because things like bad Go templates emit DEBUG level errors), but I don't want 404 errors.Proposed Solution
Ideally, I'd like to add something to my
error_handler
like:...but as described above, this does not work at the moment. Another option might be to suppress logging when using the
error
directive, for example:Example Log Entry
Other Info
Caddy v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
Installed on Ubuntu using apt package manager:
APT-Sources: https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version/main amd64 Packages
Ubuntu 22.04.5 LTS
x86_64
Launched with systemd 249
Example Caddyfile
The text was updated successfully, but these errors were encountered: