This is a fun project I created to make monitoring my logs easier (because I love to see how popular my posts are )
It’s a command-line tool that reads the JSON access logs of Caddy and filters them based on user-specified options.
My initial intention was to build a Telegram bot that filters the logs and send them to me when I need them without having to log into the server. But then I thought I should separate the filtering logic into its own Go module, this way it can be used by other people in other ideas.
The CLI is built on that module.
It’s a pretty simple one (a typical made-for-fun project). But I can see that I will be using it a lot.
You can check out the tool here:
And the library here:
As far as I know, the common logs will no longer be available in newer versions of Caddy. I will consider that in future enhancements.
Thanks Francis. The log is unmarshalled into a struct, and common log is only a field in it. I can use the other fields to create my own output format. The only challenge will be if the log json keys changed, in which case I would need to either update the code or find a way to adapt the json input to my struct.
HI @francislavoie
Are you also removing the common_log key within the file?
my little script would need some re-writing if it is the case!
Thanks in advance
M
common_log is completely removed from Caddy; the data in it was entirely redundant, the same data was already in other JSON fields; we were basically logging the same information twice. It was wasteful.