Filter access log for code 400 and above

Hey!

Here is my current log directive

log {
    output file /var/log/caddy/access.json {
        roll_size 10MB
        roll_keep 5
        roll_keep_for 240h
        format console
    }

What I would like to do is to log only requests with the code 400 and above.
Is that possible? I looked at the doc but I’m not sure!
(Sorry I come from nginx and it’s a bit of a change for me!)

Thank you!

Nope, just ignore the other log entries or have another tool filter them out for you.

would the level parameter filter them out / return only specific ones?

I’ve found this:

It’s not allowing me to filter perfectly, but at least I can change the level to warn and code 200 will not be logged :slight_smile:

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