V2 tls: & http: logs on stdout after default is redirected to file

Hopefully last new post tonight.

I have redirected my defailt logs to a file, with the following JSON:

      "default": {
        "encoder": {
          "format": "json"
        },
        "exclude": [
          "http.log.access"
        ],
        "level": "INFO",
        "writer": {
          "filename": "/var/log/caddy/server.log",
          "output": "file"
        }
      }

and it works fine, but I am still seeing TLS messages on the console (not sure if they are on stderr or stdout, I haven’t redirected them to track all emitted lines in a tmux session:

sudo -u caddyuser /home/lexpierce/bin/caddy run -resume
2020/04/24 04:23:19.300	INFO	resuming from last configuration	{"autosave_file": "/var/lib/caddyuser/.config/caddy/autosave.json"}
2020/04/24 04:23:19.302	INFO	admin	admin endpoint started	{"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["[::1]:2019", "127.0.0.1:2019", "localhost:2019"]}
2020/04/24 04:23:19.302	INFO	redirected default logger	{"from": "stderr", "to": "/var/log/caddy/server.log"}
2020/04/23 21:23:19 [INFO][cache:0xc00057b450] Started certificate maintenance routine
2020/04/23 21:26:32 http: TLS handshake error from 196.52.43.94:60460: no server TLS configuration available for ClientHello: &{CipherSuites:[52244 52243 49199 49195 49200 49196 49169 49159 49191 49187 49171 49161 49192 49188 49172 49162 52245 158 159 103 107 51 57 156 157 5 4 60 61 47 53 49170 22 10 3 8 6 20 17 25 23 50 49160 18 19 21 56 64 102 106 162 163] ServerName:192.241.205.167:443 SupportedCurves:[23 24 25] SupportedPoints:[0] SignatureSchemes:[1025 1027 513 515 514] SupportedProtos:[] SupportedVersions:[771 770 769] Conn:0xc0000961d0 config:0xc0007c0180}

I appear to see http: log messages for TLS and tls: log messages on my console. Are those special cases? Not part of default logs?

All the other log emissions go to the “sink” - i.e. logs we don’t have control of: JSON Config Structure - Caddy Documentation

They come from the Go standard library or dependencies. Unfortunately there’s not much we can do about them.

(Although, in the near-future, I plan to update CertMagic since I have control of that dependency, to use Caddy’s logging instead of Go std lib logger.)

1 Like

Ah thank you! I missed “sink” in my reading. That’s the missing link.

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