restic / rest-server

Rest Server is a high performance HTTP server that implements restic's REST backend API.
BSD 2-Clause "Simplified" License
899 stars 139 forks source link

customize log format #283

Open Framsfex opened 2 months ago

Framsfex commented 2 months ago

Output of rest-server --version

rest-server version rest-server 0.12.1 compiled with go1.20.5 on linux/386

What should rest-server do differently?

Add an option --logformat

What are you trying to do? What is your use case?

The log file has entries of this format:

129.69.202.138 - - [10/May/2024:09:38:26 +0200] "HEAD /test/config HTTP/2.0" 200 0 "" "Go-http-client/2.0"

But I prefer:

[2024-05-10 09:38:26] 129.69.202.138 - - "HEAD /test/config HTTP/2.0" 200 0 "" "Go-http-client/2.0"

Because it is easy sortable.

So, a new option like this would be great:

--logformat "[%Y-%m-%d %H:%M:%S] ..."

My workaround so far is:

rest-server $OTHER_OPTIONS --log - | perl_log_converter >> $DATA/log

Did rest-server help you today? Did it make you happy in any way?