I was reading the log directive at log (Caddyfile directive) — Caddy Documentation and it only mentions the one output file. But I was wondering if Caddy v2 supports more than one output file + format pairing for same site ?
For instance with Nginx I can setup multiple access logs for same site using different log formats i.e. set site to log to default combined format + log to a separate log file using json format.
In Nginx it would be
access_log /path/to/access.log combined buffer=256k flush=5m;
access_log /path/to/access_log.json main_json buffer=256k flush=5m;
then JSON output version would be something like
cat access_log.json | tail -1 | jq -r .
{
"http_cf_ray": "58d8c8f393bbe049-DFW",
"gzip_ratio": "4.50",
"pipe": ".",
"server_protocol": "HTTP/1.1",
"request_method": "GET",
"body_bytes_sent": "23142",
"status": "200",
"args": "/threads/ovh-new-infrastructure-line-severs-intel-xeon-e-22xx-xeon-silver-amd-epyc-7371.18392/&",
"request_uri": "/threads/ovh-new-infrastructure-line-severs-intel-xeon-e-22xx-xeon-silver-amd-epyc-7371.18392/",
"request": "GET /threads/ovh-new-infrastructure-line-severs-intel-xeon-e-22xx-xeon-silver-amd-epyc-7371.18392/ HTTP/1.1",
"time_iso8601": "2020-05-03T08:59:16+00:00",
"time_local": "03/May/2020:08:59:16 +0000",
"remote_port": "",
"msec": "1588496356.551",
"connection": "5908",
"connection_requests": "1",
"pid": "18672",
"request_id": "29e7f4290c9ecf06e780552b25883aba",
"request_length": "875",
"remote_addr": "66.249.73.203",
"remote_user": "",
"bytes_sent": "23992",
"http_referer": "",
"http_user_agent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
"http_x_forwarded_for": "66.249.73.203",
"http_host": "domain.com",
"server_name": "domain.com",
"request_time": "0.100",
"upstream": "127.0.0.1:9000",
"upstream_connect_time": "0.000",
"upstream_header_time": "0.100",
"upstream_response_time": "0.100",
"upstream_response_length": "104181",
"upstream_cache_status": "BYPASS",
"ssl_protocol": "TLSv1.3",
"ssl_cipher": "TLS_AES_256_GCM_SHA384",
"scheme": "https"
}