How to disable specific logs?

1. Caddy version (caddy version):

v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=

2. How I run Caddy:

official docker container

Question

I have some very talkative servers I would like to quiet. An example of such a log is

{
  "level": "info",
  "ts": 1595748542.2592723,
  "logger": "http.log.access",
  "msg": "handled request",
  "request": {
    "method": "GET",
    "uri": "/",
    "proto": "HTTP/1.1",
    "remote_addr": "172.19.0.1:52808",
    "host": "elasticsearch.example.com:80",
    "headers": {
      "User-Agent": [
        "Go-http-client/1.1"
      ],
      "Accept": [
        "application/json"
      ],
      "Accept-Encoding": [
        "gzip"
      ]
    }
  },
  "common_log": "172.19.0.1 - - [26/Jul/2020:07:29:02 +0000] \"GET / HTTP/1.1\" 308 0",
  "duration": 0.000081632,
  "size": 0,
  "status": 308,
  "resp_headers": {
    "Server": [
      "Caddy"
    ],
    "Location": [
      "https://elasticsearch.example.com/"
    ],
    "Connection": [
      "close"
    ],
    "Content-Type": []
  }
}

It is generated by

https://elasticsearch.example.com {
        reverse_proxy elasticsearch:9200
}

Is there a way, for a specific site, to either completely disable logs or filter at the level field? (to leave for example everything above info)

I saw some discussion about that feature in https://github.com/caddyserver/caddy/pull/2028 but did not find anything relevant in the documentation.

Somehow I missed the point that it is enough to have a

log {
  level: ERROR
}

entry inside the definition of a site. (I thought that log was global)

2 Likes

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