diff options
author | Stefan Raspl <raspl@de.ibm.com> | 2020-04-02 10:57:04 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-04-21 09:13:12 -0400 |
commit | 3754afe7cf7cc3693a9c9ff795e9bd97175ca639 (patch) | |
tree | 8f2c57b6dda1b245fe3436bd762f0f5f5ecafe30 /block/blk-mq-sched.h | |
parent | da1fda288943c37de8e1513b98f6dda40c8cd421 (diff) | |
download | linux-3754afe7cf7cc3693a9c9ff795e9bd97175ca639.tar.gz linux-3754afe7cf7cc3693a9c9ff795e9bd97175ca639.tar.bz2 linux-3754afe7cf7cc3693a9c9ff795e9bd97175ca639.zip |
tools/kvm_stat: Add command line switch '-L' to log to file
To integrate with logrotate, we have a signal handler that will re-open
the logfile.
Assuming we have a systemd unit file with
ExecStart=kvm_stat -dtc -s 10 -L /var/log/kvm_stat.csv
ExecReload=/bin/kill -HUP $MAINPID
and a logrotate config featuring
postrotate
/bin/systemctl reload kvm_stat.service
endscript
Then the overall flow will look like this:
(1) systemd starts kvm_stat, logging to A.
(2) At some point, logrotate runs, moving A to B.
kvm_stat continues to write to B at this point.
(3) After rotating, logrotate restarts the kvm_stat unit via systemctl.
(4) The kvm_stat unit sends a SIGHUP to kvm_stat, finally making it
switch over to writing to A again.
Note that in order to keep the structure of the cvs output in tact, we
make sure to, in contrast to the standard log format, only write the
header once at the beginning of a file. This implies that the header is
suppressed when appending to an existing file. Unlike with the standard
format, where we append to an existing file by starting out with a
header.
Signed-off-by: Stefan Raspl <raspl@de.ibm.com>
Message-Id: <20200402085705.61155-3-raspl@linux.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block/blk-mq-sched.h')
0 files changed, 0 insertions, 0 deletions