vmstat does not have an option to log timestamps which may cause its logs to be difficult to interpret later.
The workaround is to use awk to generate timestamp and print vmstat output plus data:
# vmstat 1 | awk '{now=strftime("%Y-%m-%d %T "); print now $0}'
2014-02-08 06:54:15 procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
2014-02-08 06:54:15 r b swpd free buff cache si so bi bo in cs us sy id wa
2014-02-08 06:54:15 2 0 82928 122172 38016 746940 1 1 14 17 86 109 15 2 82 1
2014-02-08 06:54:16 2 0 82928 149692 38016 716668 0 0 0 0 827 1354 14 4 83 0
Fortunately
iostat on Linux have
-t switch which adds timestamp for every output.
However if you're using iostat on system where -t switch is not available you may use the same trick we did with vmstat.