userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.37k stars 275 forks source link

Log rotatation proposal: placeholders - a step towards boost log sink #673

Open Turim opened 1 month ago

Turim commented 1 month ago

Documentation doesn't say much about the log rotation:

I only might see that the rotation is an option to pull the filename out (probably in order to reduce the consumed space). I'd like to have the log file at least for ~8-24-48h. Today I see current rotation as all-or-nothing approach. Is it so?

What do you think if we'd supported at least simple placeholders:

So one could on new file compress and send the used file or just compress..?

apolukhin commented 6 days ago

I'd rather not go that direction. The functionality of logrotate is quite big https://linux.die.net/man/8/logrotate

So rather than implementing logrotate I'd recommend relying on it and using signals to notify the server to reopen the log file https://userver.tech/df/d4e/md_en_2userver_2os__signals.html