You can read how logging works here: How Logging Works — Caddy Documentation and here: JSON Config Structure - Caddy Documentation
Right, that’s because the common log format does not include user agent. I complain about this in our logging page: How Logging Works — Caddy Documentation
Actually @nicolinux posted a Wiki article that explains how to do this: Making Caddy logs more readable