Web / Caddy Server Interview questions
How do you configure access logging in Caddy?
The log directive turns on structured access logging for a site block and lets you control the output destination and format.
example.com { log { output file /var/log/caddy/access.log { roll_size 10mb roll_keep 10 } format json } file_server }
By default, logs are written as JSON lines to stderr, which is convenient for container platforms that collect stdout/stderr. The example above instead writes to a rotating file, capping each file at 10 MB and keeping the last 10 rotated files. The format subdirective can also switch to a more compact console layout for local development.
More Related questions...