summaryrefslogtreecommitdiffstats
path: root/tools/kvm/kvm_stat/kvm_stat.txt
diff options
context:
space:
mode:
authorStefan Raspl <raspl@de.ibm.com>2020-04-02 10:57:04 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-04-21 15:13:12 +0200
commit3754afe7cf7cc3693a9c9ff795e9bd97175ca639 (patch)
tree8f2c57b6dda1b245fe3436bd762f0f5f5ecafe30 /tools/kvm/kvm_stat/kvm_stat.txt
parenttools/kvm_stat: add command line switch '-z' to skip zero records (diff)
downloadlinux-3754afe7cf7cc3693a9c9ff795e9bd97175ca639.tar.xz
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 'tools/kvm/kvm_stat/kvm_stat.txt')
-rw-r--r--tools/kvm/kvm_stat/kvm_stat.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/kvm/kvm_stat/kvm_stat.txt b/tools/kvm/kvm_stat/kvm_stat.txt
index 24296dccc00a..feaf46451e83 100644
--- a/tools/kvm/kvm_stat/kvm_stat.txt
+++ b/tools/kvm/kvm_stat/kvm_stat.txt
@@ -65,8 +65,10 @@ OPTIONS
run in batch mode for one second
-c::
---csv=<file>::
- log in csv format - requires option -l/--log
+--csv::
+ log in csv format. Requires option -l/--log or -L/--log-to-file.
+ When used with option -L/--log-to-file, the header is only ever
+ written to start of file to preserve the format.
-d::
--debugfs::
@@ -92,6 +94,11 @@ OPTIONS
--log::
run in logging mode (like vmstat)
+
+-L<file>::
+--log-to-file=<file>::
+ like -l/--log, but logging to a file. Appends to existing files.
+
-p<pid>::
--pid=<pid>::
limit statistics to one virtual machine (pid)