rest-server icon indicating copy to clipboard operation
rest-server copied to clipboard

customize log format

Open Framsfex opened this issue 1 year ago • 0 comments

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?

Framsfex avatar May 10 '24 07:05 Framsfex