Trace file rotation to consider older sessions in same tree
The existing trace rotation / size limiting feature is very useful, and allows one to run a trace session constantly, starting at boot time.
However, the existing mechanism will overwrite the trace session completely if the system is rebooted.
Since embedded systems often require some kind of hot-upgrade mechanism, a reboot is not uncommon when doing an upgrade. Having traces from before the upgrade is very useful to debug upgrade issues.
Our suggestion is to add a new argument to 'lttng enable-channel' command : "-D top_directory", that will tell the trace rotation mechanism to look for older sessions under top_directory, and remove older files from those sessions and maybe entire sessions when the limit of max_files * max_file_size is crossed.