You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, the configured output of Caddy logs is console output which is only slightly more readable than JSON logs. Especially when wrapping in a tailed terminal window during development. It's not really a format designed for easy consumption by humans.
There is a caddy module written by the caddy authors called "transform-encoder". But it's not included by default. However, I personally would love it to be built into your images by default. It will sit there dormant until configured by some environment var(s).
I'm not sure why the caddy authors didn't add it by default. The caddy webpage states their strong opinion for structured JSON logs which might be why. My personal opinion is if it's only ever going to be for human consumption then why make it difficult. It would be nice to allow a personal preference.
Detail 1
We would just need to add this to the caddy build step.
I do think maybe format {$CADDY_LOG_FORMAT:console} should be defined in the Caddyfile in the current beta 4 so users can add "json" as the output format.
i.e.
$CADDY_LOG_FORMAT="json"
🥰 Describe the "impact" on users?
So by default output looks the same as it does now. But I have the option of using common_log format if I wish. Or defining my own template according to the transform encoder docs.
💯 How do we validate the problem is solved?
Users will have the ability ability to enable common_log format or other flexible formats with environment vars(s) without having to create a custom build.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👉 Describe the problem
By default, the configured output of Caddy logs is console output which is only slightly more readable than JSON logs.
Especially when wrapping in a tailed terminal window during development. It's not really a format designed for easy consumption by humans.
👥 Problem evidence & reach
(#283 (comment))
🏆 How to solve this problem
There is a caddy module written by the caddy authors called "transform-encoder". But it's not included by default. However, I personally would love it to be built into your images by default. It will sit there dormant until configured by some environment var(s).
I'm not sure why the caddy authors didn't add it by default. The caddy webpage states their strong opinion for structured JSON logs which might be why. My personal opinion is if it's only ever going to be for human consumption then why make it difficult. It would be nice to allow a personal preference.
Detail 1
We would just need to add this to the caddy build step.
For further info see:
Detail 2
Possible Env var option:
$CADDY_LOG_FORMAT="transform '{common_log}'"
Caddyfile
I do think maybe format {$CADDY_LOG_FORMAT:console} should be defined in the Caddyfile in the current beta 4 so users can add "json" as the output format.
i.e.
🥰 Describe the "impact" on users?
So by default output looks the same as it does now. But I have the option of using
common_logformat if I wish.Or defining my own template according to the transform encoder docs.
💯 How do we validate the problem is solved?
Users will have the ability ability to enable common_log format or other flexible formats with environment vars(s) without having to create a custom build.
Beta Was this translation helpful? Give feedback.
All reactions