Also considered but much more effort:https://github.com/traccar/traccar/issues/3994
^^ this might be another option but would required integration with a variety of syslogging products. It has to be considered that Traccar is used on other platforms apart from Linux+rsyslog.
Why logrotate?
Logrotate or other similar log rotation mechanisms don't require complex integration and code change but mostly work out of the box.
What is missing:
Yet there is one item that could be improved: Once a log file has been renamed (rotated) Traccar is required start writing into a new log file with the same name, so basically re-create the original (now empty) log file. Currently this can be achieved by restarting Traccar entirely but means an interruption of service and a potential loss of communication - especially on large systems.
So it is desired to have a functionality to send a signal to the running Traccar server which triggers the closing and re-creation of the log file while keeping the rest of the service running. Similar to how it is described here: https://github.com/log4js-node/log4js-node/issues/343
Challenge: To maintain log file disk usage you have to accomplish 2 main points:
Proposed solution: A solution to this is possible today already via logrotate: https://www.traccar.org/forums/topic/log-file-size/#post-72460
Also considered but much more effort: https://github.com/traccar/traccar/issues/3994 ^^ this might be another option but would required integration with a variety of syslogging products. It has to be considered that Traccar is used on other platforms apart from Linux+rsyslog.
Why logrotate? Logrotate or other similar log rotation mechanisms don't require complex integration and code change but mostly work out of the box.
What is missing: Yet there is one item that could be improved: Once a log file has been renamed (rotated) Traccar is required start writing into a new log file with the same name, so basically re-create the original (now empty) log file. Currently this can be achieved by restarting Traccar entirely but means an interruption of service and a potential loss of communication - especially on large systems.
So it is desired to have a functionality to send a signal to the running Traccar server which triggers the closing and re-creation of the log file while keeping the rest of the service running. Similar to how it is described here: https://github.com/log4js-node/log4js-node/issues/343