On 06/03/20 12:42, Stefan Raspl wrote: > This patch series provides a couple of new options to make logging to > files feasible. > Specifically, we add command line switches to specify an arbitrary time > interval for logging, and to toggle between a .csv and the previous > file format. Furthermore, we allow logging to files, where we utilize a > rotating set of 6 logfiles, each with its own header for easy post- > processing, especially when using .csv format. > Since specifying logfile size limits might be a non-trivial exercise, > we're throwing in yet another command line option that allows to > specify the minimum timeframe that should be covered by logs. > Finally, there's a minimal systemd unit file to deploy kvm_stat-based > logging in Linux distributions. > Note that the decision to write our own logfiles rather than to log to > e.g. systemd journal is a conscious one: It is effectively impossible to > write csv records into the systemd journal, the header will either > disappear after a while or has to be repeated from time to time, which > defeats the purpose of having a .csv format that can be easily post- > processed, etc. > See individual patch description for further details. > > > Stefan Raspl (7): > tools/kvm_stat: rework command line sequence and message texts > tools/kvm_stat: switch to argparse > tools/kvm_stat: add command line switch '-s' to set update interval > tools/kvm_stat: add command line switch '-c' to log in csv format > tools/kvm_stat: add rotating log support > tools/kvm_stat: add command line switch '-T' > tools/kvm_stat: add sample systemd unit file > > tools/kvm/kvm_stat/kvm_stat | 434 +++++++++++++++++++++------- > tools/kvm/kvm_stat/kvm_stat.service | 15 + > tools/kvm/kvm_stat/kvm_stat.txt | 59 ++-- > 3 files changed, 384 insertions(+), 124 deletions(-) > create mode 100644 tools/kvm/kvm_stat/kvm_stat.service > I queued patches 1-4. For the others, however, I would prefer to add support for SIGHUP instead (to reopen the logfile), so that one can use the usual logrotate services. Paolo