Error log msg "handled request", what does this mean?

1. The problem I’m having:

I have set up Caddy container behind traefik on a different domain than traefik, but all my container on the same VPS with the same IP, and I also using Cloudflare. Traefik uses letsencrypt for one domain, and Caddy uses Cloudflare origin SSL certs directly on another domain. After spending some time, I successfully set them up and Caddy seems to serve the request to the different domain well. The only thing is that I find odd in the log message, there is an error even the reuqest seems process successfully.

2. Error messages and/or full log output:

ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 logger=http.log.access./opt/logs/access.log ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 logger=http.log.access./opt/logs/access.log msg=handled request ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 logger=http.log.access./opt/logs/access.log ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 ERR ERR ERR ERR ERR ERR ERR ERR ts=1701596202.6291509 logger=http.log.access./opt/logs/access.log msg=handled request request={“remote_ip”:“172.23.0.3”,“remote_port”:“48508”,“client_ip”:“172.23.0.3”,“proto”:“HTTP/2.0”,“method”:“GET”,“host”:“…”,“uri”:“/favicon.ico”,“headers”:{“X-Forwarded-Proto”:[“https”],“Sec-Ch-Ua”:[“"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"”],“User-Agent”:[“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36”],“Accept”:[“/”],“Sec-Fetch-Mode”:[“cors”],“Cf-Connecting-Ip”:[“2a09:bac5:1f0b:28::4:243”],“Cdn-Loop”:[“cloudflare”],“Accept-Encoding”:[“gzip”],“Cf-Access-Authenticated-User-Email”:[“osdsfdsdf@gmail.com”],“Sec-Ch-Ua-Platform”:[“"macOS"”],“Cookie”:,“Accept-Language”:[“zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6,zh-TW;q=0.5,fr;q=0.4,la;q=0.3”],“Priority”:[“u=1, i”],“Cf-Ipcountry”:[“CN”],“X-Forwarded-For”:[“2a09:bac5:1f0b:28::4:243”],“Cf-Access-Jwt-Assertion”:[“…”],“Cf-Visitor”:[“{"scheme":"https"}”],“Sec-Ch-Ua-Mobile”:[“?0”],“Cf-Ray”:[“82fad3a9ca972554-SJC”],“Sec-Fetch-Site”:[“same-origin”],“Sec-Fetch-Dest”:[“empty”],“Referer”:[“https://…/”]},“tls”:{“resumed”:false,“version”:772,“cipher_suite”:4865,“proto”:“h2”,“server_name”:“…”}}

3. Caddy version: 2.7.5

4. How I installed and ran Caddy:

docker compose

a. System environment:

Ubuntu 22.04 with Docker 20.10.23 on linux, amd64

b. Command:

No command error, as said it seems working fine, just need ask about the confusing error log message.

c. Service/unit/compose file:

version: '3.3'

services:
  caddy:
    image: caddy:latest
    container_name: Caddy
    restart: unless-stopped
    volumes:
      - '/home/ubuntu/docker/caddy/conf/Caddyfile:/etc/caddy/Caddyfile'
      - '/home/ubuntu/docker/caddy/ssl:/etc/ssl'
      - '/home/ubuntu/docker/caddy/.caddy:/root/.caddy'
      - '/home/ubuntu/docker/caddy/caddy_data:/data'
      - '/home/ubuntu/docker/caddy/logs:/opt/logs'
      - '/home/ubuntu/caddy/www:/opt/www'
    labels:
      - 'traefik.enable=true'
      - 'traefik.tcp.routers.Caddy.rule=HostSNI(`........`)'
      - 'traefik.tcp.routers.Caddy.tls=true'
      - 'traefik.tcp.routers.Caddy.tls.passthrough=true'
      - 'traefik.tcp.services.Caddy.loadbalancer.server.port=443'
      - 'traefik.docker.network=traefik_default'
    networks:
      traefik_default:
    security_opt:
      - no-new-privileges:true

networks:
  traefik_default:
    external: true

d. My complete Caddy config:

{
	ocsp_stapling off
}
developdoman.me {
	tls /etc/ssl/certs/certificate.pem /etc/ssl/private/key.pem {
	}
	root * /opt/www
	file_server
	log /opt/logs/access.log
}

5. Links to relevant resources:

None.

This is invalid syntax, the log directive does not take a file path as its first argument, it takes a logger name. Please see the docs.

Your log output looks insane. What tooling are you use to read your logs? Caddy emits regular JSON logs by default, so whatever you’re using is transforming the logs in a bad way.

Your logs also look incomplete, I don’t see the status field which would tell you the HTTP response status code that was written.

If the status code is 400 or higher, then we write access logs at ERROR level. 399 and below are logged at INFO level.

This just means that some error happened for that request. Since it was for /favicon.ico, I assume that file doesn’t exist in your root. Browsers always request this file to show an icon in the tab bar if possible. You can safely ignore these (or you can create a favicon file if you want).

Thanks.
I changed the log to:

log {
output file /opt/logs/access.log
}

And, I use portainer to view the logs, but somehow the copied log lines are not formatted correctly.
Now, this error seems gone automatically. I think it might related to Cloudflare request.

I recommend you open a ticket with Portainer to get them to look into that. They’re doing some weird stuff with log output.

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