How to collect system activity information

Collect and report system activity information using sysstat a system performance tools for the Linux operating system.

Installation

Install sysstat package.

$ sudo apt install sysstat

Enable collecting activity reports.

$ sudo sed -i -e "/^ENABLED/{s/false/true/}" /etc/default/sysstat

Default settings will look like this.

$ cat /etc/default/sysstat 
#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#

# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"

By default activity reports are collected every 10 minutes.

$ cat /etc/cron.d/sysstat
# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

# Activity reports every 10 minutes everyday
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

# Additional run at 23:59 to rotate the statistics file
59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2

This is the place to look when you want to change how often activity reports are collected.

Basic configuration

You can create /etc/sysstat/sysstat configuration file to define additional settings.

Variable Default value Description
SA_DIR /var/log/sysstat Directory used to store collected system activity data
HISTORY 7 Keep collected system activity for defined number of days
COMPRESSAFTER 10 Compress collected system activity after defined number of days
ZIP xz Application used to compress data
YESTERDAY Provides possibility to generate current report instead of yesterday's summary
REPORTS Provides possibility to disable daily reports
SADC_OPTIONS -S DISK Additional options for system activity data collector

Data collector configuration

Storing HISTORY for more than 28 days will automatically use file names like saYYYYMMDD instead of saDD.

Exclusive lock on the system activity file is not used by default, but you can add -L option apply this behavior.

To store more detailed system activity define -S ALL option (all activities including disk activities) or -S XALL (all activities including disk and partition/filesystem activities).

Final configuration

My personal configuration looks like this.

$ cat  /etc/sysstat/sysstat
# sysstat configuration file. See sysstat(5) manual page.

# How long to keep log files (in days).
# Used by sa2(8) script
# If value is greater than 28, then use sadc's option -D to prevent older
# data files from being overwritten. See sadc(8) and sysstat(5) manual pages.
HISTORY=90

# Compress (using xz, gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=14

# Parameters for the system activity data collector (see sadc(8) manual page)
# which are used for the generation of log files.
# By default contains the `-S DISK' option responsible for generating disk
# statisitcs. Use `-S XALL' to collect all available statistics.
SADC_OPTIONS="-S XALL"

# Directory where sa and sar files are saved. The directory must exist.
SA_DIR=/var/log/sysstat

# Compression program to use.
ZIP="xz"

# By default sa2 script generates yesterday's summary, since the cron job
# usually runs right after midnight. If you want sa2 to generate the summary
# of the same day (for example when cron job runs at 23:53) set this variable.
#YESTERDAY=no

# By default sa2 script generates reports files (the so called sarDD files).
# Set this variable to false to disable reports generation.
REPORTS=false

Basic usage

Report CPU utilization.

$ sar -u ALL
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01        CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle
00:05:01        all      1.19      0.00      0.70      0.32      0.00      0.00      0.18      0.00      0.00     97.61
00:15:01        all      1.20      0.00      0.67      0.27      0.00      0.00      0.16      0.00      0.00     97.71
00:25:01        all      1.20      0.00      0.69      0.26      0.00      0.00      0.15      0.00      0.00     97.70
00:35:01        all      1.18      0.00      0.69      0.27      0.00      0.00      0.16      0.00      0.00     97.70
00:45:01        all      1.18      0.00      0.70      0.28      0.00      0.00      0.14      0.00      0.00     97.70
00:55:01        all      1.19      0.00      0.69      0.25      0.00      0.00      0.16      0.00      0.00     97.71
01:05:01        all      1.21      0.00      0.71      0.26      0.00      0.00      0.15      0.00      0.00     97.67
[...]
17:15:01        all      1.26      0.00      0.74      0.29      0.00      0.00      0.16      0.00      0.00     97.55
17:25:01        all      1.27      0.00      0.78      0.27      0.00      0.00      0.17      0.00      0.00     97.52
17:35:01        all      1.31      0.00      0.79      0.29      0.00      0.00      0.16      0.00      0.00     97.45
17:45:01        all      1.23      0.00      0.73      0.29      0.00      0.00      0.17      0.00      0.00     97.58
17:55:01        all      1.25      0.00      0.75      0.25      0.00      0.00      0.16      0.00      0.00     97.60
18:05:01        all      1.29      0.00      0.77      0.28      0.00      0.00      0.17      0.00      0.00     97.50
18:15:01        all      1.26      0.00      0.74      0.27      0.00      0.00      0.17      0.00      0.00     97.56
18:25:01        all      1.27      0.00      0.76      0.27      0.00      0.00      0.16      0.00      0.00     97.54
18:35:01        all      1.28      0.00      0.77      0.27      0.00      0.00      0.17      0.00      0.00     97.50
Average:        all      1.22      0.00      0.71      0.27      0.00      0.00      0.16      0.00      0.00     97.64

Report per-processor CPU utilization.

$ sar -P ALL
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:05:01        all      1.19      0.00      0.88      0.32      0.00     97.61
00:05:01          0      1.40      0.00      1.36      0.23      0.00     97.01
00:05:01          1      1.30      0.01      1.24      0.54      0.00     96.92
00:05:01          2      1.68      0.00      1.15      0.40      0.00     96.77
00:05:01          3      1.24      0.00      1.03      0.22      0.00     97.51
00:05:01          4      1.23      0.00      0.78      0.25      0.00     97.75
00:05:01          5      1.09      0.00      0.56      0.31      0.00     98.04
[...]
18:25:01          7      1.24      0.00      0.62      0.23      0.00     97.92
Average:        all      1.22      0.00      0.87      0.27      0.00     97.64
Average:          0      1.28      0.00      1.39      0.25      0.00     97.09
Average:          1      1.37      0.00      1.10      0.25      0.00     97.27
Average:          2      1.31      0.00      1.13      0.25      0.00     97.31
Average:          3      1.22      0.00      0.90      0.24      0.00     97.63
Average:          4      1.15      0.00      0.65      0.28      0.00     97.92
Average:          5      1.17      0.00      0.61      0.30      0.00     97.91
Average:          6      1.14      0.00      0.59      0.29      0.00     97.97
Average:          7      1.10      0.00      0.57      0.28      0.00     98.04

Report memory utilization.

$ sar -r ALL
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty  kbanonpg    kbslab  kbkstack   kbpgtbl  kbvmused
00:05:01     32777820  32851276     47492      0.14         0     73456  13793352     26.32     62448     21220        12   4768392         0     14512     52200         0
00:15:01     32777588  32851044     47724      0.15         0     73456  13789980     26.31     62416     21220         8   4769624         0     14448     52204         0
00:25:01     32777680  32851136     47632      0.14         0     73456  13846336     26.42     62404     21220        20   4779044         0     14464     52196         0
00:35:01     32777756  32851212     47556      0.14         0     73456  13802616     26.33     62424     21220         4   4785720         0     14512     52332         0
00:45:01     32778032  32851488     47280      0.14         0     73456  13814180     26.36     62432     21220         8   4785704         0     14496     52200         0
00:55:01     32777904  32851360     47408      0.14         0     73456  13812644     26.35     62440     21220         8   4786292         0     14432     52132         0
01:05:01     32777980  32851436     47332      0.14         0     73456  13820720     26.37     62404     21220       160   4816384         0     14448     52376         0
[...]
17:35:01     32746380  32850064     48704      0.15         0    103684  14110332     26.92     94636     19616         4   5233252         0     15120     53100         0
17:45:01     32746840  32850524     48244      0.15         0    103684  14122524     26.94     94632     19612         4   5232584         0     15312     53320         0
17:55:01     32745460  32849144     49624      0.15         0    103684  14135848     26.97     95496     19612         0   5228068         0     15152     53176         0
18:05:01     32743352  32847168     51600      0.16         0    103816  14115440     26.93     97720     19620         8   5245400         0     15200     53316         0
18:15:01     32746428  32850244     48524      0.15         0    103816  14126236     26.95     94752     19628         0   5241028         0     15152     53416         0
18:25:01     32746304  32850120     48648      0.15         0    103816  14114288     26.93     94936     19640         4   5216108         0     15136     53236         0
18:35:01     32775564  32849800     48968      0.15         0     74236  14127384     26.95     65196     19748         8   5220928         0     15840     53284         0
18:45:01     32774080  32848316     50452      0.15         0     74236  14130340     26.96     66312     19628         8   5221756         0     15184     53300         0
18:55:01     32774280  32848516     50252      0.15         0     74236  14127640     26.95     66324     19628         0   5208968         0     15136     53300         0
Average:     32758329  32851164     47604      0.14         0     92835  13723997     26.18     81214     21617        53   4993330         0     14316     51488         0

Report swap space utilization.

$ sar -S
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01    kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
00:05:01     19514236         0      0.00         0      0.00
00:15:01     19514236         0      0.00         0      0.00
00:25:01     19514236         0      0.00         0      0.00
00:35:01     19514236         0      0.00         0      0.00
00:45:01     19514236         0      0.00         0      0.00
00:55:01     19514236         0      0.00         0      0.00
01:05:01     19514236         0      0.00         0      0.00
[...]
17:05:01     19514236         0      0.00         0      0.00
17:15:01     19514236         0      0.00         0      0.00
17:25:01     19514236         0      0.00         0      0.00
17:35:01     19514236         0      0.00         0      0.00
17:45:01     19514236         0      0.00         0      0.00
17:55:01     19514236         0      0.00         0      0.00
18:05:01     19514236         0      0.00         0      0.00
18:15:01     19514236         0      0.00         0      0.00
18:25:01     19514236         0      0.00         0      0.00
Average:     19514236         0      0.00         0      0.00

Report hugepages utilization.

$ sar -H
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01    kbhugfree kbhugused  %hugused
00:05:01            0         0      0.00
00:15:01            0         0      0.00
00:25:01            0         0      0.00
00:35:01            0         0      0.00
00:45:01            0         0      0.00
00:55:01            0         0      0.00
01:05:01            0         0      0.00
[...]
17:05:01            0         0      0.00
17:15:01            0         0      0.00
17:25:01            0         0      0.00
17:35:01            0         0      0.00
17:45:01            0         0      0.00
17:55:01            0         0      0.00
18:05:01            0         0      0.00
18:15:01            0         0      0.00
18:25:01            0         0      0.00
Average:            0         0      0.00

Report paging statistics.

$ sar -B
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01     pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
00:05:01         0.03    495.87    627.40      5.25   1033.93      0.00      0.00      0.00      0.00
00:15:01         0.12    547.95    492.40      0.00    905.45      0.00      0.00      0.00      0.00
00:25:01         0.03    465.46    490.89      0.00    900.52      0.00      0.00      0.00      0.00
00:35:01         0.17    444.77    498.67      0.01    913.55      0.00      0.00      0.00      0.00
00:45:01         0.00    491.91    494.49      0.00    915.29      0.00      0.00      0.00      0.00
00:55:01         3.24    532.03    501.46      0.00    926.38      0.00      0.00      0.00      0.00
01:05:01         0.80    620.96    496.81      0.07   1037.30      0.00      0.00      0.00      0.00
[...]
17:05:01         0.36    839.39    506.22      0.07    979.97      0.00      0.00      0.00      0.00
17:15:01         0.70    767.18    531.67      0.00   1003.84      0.00      0.00      0.00      0.00
17:25:01         0.12    801.29    536.39      0.03   1021.67      0.00      0.00      0.00      0.00
17:35:01         0.28    846.93    535.55      0.02   1021.78      0.00      0.00      0.00      0.00
17:45:01         0.38    859.77    517.30      0.00    998.41      0.00      0.00      0.00      0.00
17:55:01         3.91    562.38    502.70      0.00    959.94      0.00      0.00      0.00      0.00
18:05:01         0.27    808.23    519.15      0.05    993.07      0.00      0.00      0.00      0.00
18:15:01         0.03    683.87    517.77      0.01    979.05      0.00      0.00      0.00      0.00
18:25:01         0.30    737.74    514.47      0.07    987.79      0.00      0.00      0.00      0.00
Average:         1.02    664.22    537.04      0.55   1023.61      0.00      0.00      0.00      0.00

Report swapping statistics.

$ sar -W
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01     pswpin/s pswpout/s
00:05:01         0.00      0.00
00:15:01         0.00      0.00
00:25:01         0.00      0.00
00:35:01         0.00      0.00
00:45:01         0.00      0.00
00:55:01         0.00      0.00
01:05:01         0.00      0.00
[...]
17:05:01         0.00      0.00
17:15:01         0.00      0.00
17:25:01         0.00      0.00
17:35:01         0.00      0.00
17:45:01         0.00      0.00
17:55:01         0.00      0.00
18:05:01         0.00      0.00
18:15:01         0.00      0.00
18:25:01         0.00      0.00
Average:         0.00      0.00

Report I/O and transfer rate statistics.

$ sar -b
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01          tps      rtps      wtps   bread/s   bwrtn/s
00:05:01         0.63      0.63      0.00      0.01      0.00
00:15:01         0.00      0.00      0.00      0.00      0.00
00:25:01         0.00      0.00      0.00      0.00      0.00
00:35:01         0.00      0.00      0.00      0.00      0.00
00:45:01         0.00      0.00      0.00      0.00      0.00
00:55:01         0.00      0.00      0.00      0.00      0.00
01:05:01         0.00      0.00      0.00      0.00      0.00
[...]
17:05:01         0.01      0.01      0.00      0.34      0.00
17:15:01         0.01      0.01      0.00      0.99      0.00
17:25:01         0.01      0.01      0.00      0.20      0.00
17:35:01         0.00      0.00      0.00      0.56      0.00
17:45:01         0.00      0.00      0.00      0.00      0.00
17:55:01         0.00      0.00      0.00      0.00      0.00
18:05:01         0.01      0.01      0.00      0.48      0.00
18:15:01         0.00      0.00      0.00      0.00      0.00
18:25:01         0.01      0.01      0.00      0.40      0.00
Average:         0.01      0.01      0.00      0.12      0.00

Report block device activity.

$ sar -d
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01          DEV       tps     rkB/s     wkB/s   areq-sz    aqu-sz     await     svctm     %util
00:05:01      dev8-16      0.31      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:05:01       dev8-0      0.32      0.01      0.00      0.02      0.00      0.34      0.33      0.01
00:15:01      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01       dev8-0      0.00      0.00      0.00      0.50      0.00     11.00     11.00      0.00
00:35:01      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[...]
17:55:01      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
17:55:01       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
18:05:01      dev8-16      0.00      0.24      0.00     71.25      0.00      8.00      8.00      0.00
18:05:01       dev8-0      0.00      0.00      0.00      1.00      0.00      8.00      8.00      0.00
18:15:01      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
18:15:01       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
18:25:01      dev8-16      0.01      0.16      0.00     31.83      0.00     10.33     10.33      0.01
18:25:01       dev8-0      0.00      0.04      0.00     12.75      0.00     15.50     15.50      0.01
Average:      dev8-16      0.00      0.04      0.00     12.47      0.00      2.16      2.07      0.00
Average:       dev8-0      0.00      0.03      0.00      7.69      0.00      3.38      3.36      0.00

Report process creation and system switching activity.

$ sar -w
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01       proc/s   cswch/s
00:05:01        37.69   2005.97
00:15:01        35.54   1963.31
00:25:01        36.42   1972.02
00:35:01        36.57   1965.92
00:45:01        36.00   1957.36
00:55:01        35.84   1967.56
01:05:01        42.18   2080.09
[...]
17:05:01        38.20   2080.53
17:15:01        37.26   2270.71
17:25:01        40.89   2561.91
17:35:01        39.85   2776.74
17:45:01        38.69   2116.36
17:55:01        37.11   2020.83
18:05:01        38.25   2656.46
18:15:01        39.23   2363.74
18:25:01        38.40   2488.49
Average:        38.68   2058.42

Report queue length and load averages.

$ sar -q
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
00:05:01            0       901      0.04      0.22      0.26         0
00:15:01            2       898      0.18      0.26      0.26         0
00:25:01            1       899      0.02      0.08      0.17         0
00:35:01            0       901      0.25      0.16      0.14         0
00:45:01            0       901      0.01      0.05      0.08         0
00:55:01            0       899      0.25      0.26      0.16         0
01:05:01            0       901      0.12      0.19      0.17         0
[...]
17:05:01            0       935      0.38      0.21      0.13         0
17:15:01            0       936      0.70      0.57      0.35         0
17:25:01            0       945      0.08      0.28      0.31         0
17:35:01            0       941      0.37      0.31      0.29         0
17:45:01            0       952      0.06      0.14      0.21         0
17:55:01            0       942      0.48      0.18      0.17         0
18:05:01            0       942      0.12      0.15      0.16         0
18:15:01            0       938      0.10      0.07      0.09         0
18:25:01            0       940      0.57      0.30      0.19         0
Average:            0       888      0.20      0.20      0.18         0

Report network utilization.

$ sar -n ALL
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

00:00:01        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
00:05:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:05:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01         eth0      0.01      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01         eth0      0.01      0.01      0.00      0.00      0.00      0.00      0.00      0.00
[...]
00:00:01        IFACE   rxerr/s   txerr/s    coll/s  rxdrop/s  txdrop/s  txcarr/s  rxfram/s  rxfifo/s  txfifo/s
00:05:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:05:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01         eth0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[...]
00:00:01       call/s retrans/s    read/s   write/s  access/s  getatt/s
00:05:01         0.00      0.00      0.00      0.00      0.00      0.00
00:15:01         0.00      0.00      0.00      0.00      0.00      0.00
00:25:01         0.00      0.00      0.00      0.00      0.00      0.00
[...]
00:00:01      scall/s badcall/s  packet/s     udp/s     tcp/s     hit/s    miss/s   sread/s  swrite/s saccess/s sgetatt/s
00:05:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:15:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
00:25:01         0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[...]
00:00:01       totsck    tcpsck    udpsck    rawsck   ip-frag    tcp-tw
00:05:01           39         1         1         0         0         0
00:15:01           37         1         1         0         0         0
00:25:01           39         1         1         0         0         0
[...]
00:00:01        CPU   total/s   dropd/s squeezd/s  rx_rps/s flw_lim/s
00:05:01        all    104.11      0.00      0.41      0.00      0.00
00:15:01        all    105.80      0.00      0.31      0.00      0.00
00:25:01        all    107.91      0.00      0.42      0.00      0.00
[...]
17:55:01        all    111.76      0.00      0.41      0.00      0.00
18:05:01        all    113.60      0.00      0.47      0.00      0.00
18:15:01        all    107.98      0.00      0.45      0.00      0.00
18:25:01        all    109.00      0.00      0.41      0.00      0.00
Average:        all    106.91      0.00      0.38      0.00      0.00

Advanced usage

Display data in human readable way.

$ sar -r -h
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

19:55:01    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
20:05:01        31.3G     31.3G     48.1M      0.1%      0.0k     72.5M     13.4G     26.9%     63.6M     19.3M      8.0k
20:15:01        31.3G     31.3G     48.1M      0.1%      0.0k     72.5M     13.4G     26.9%     63.6M     19.3M      8.0k
20:25:01        31.3G     31.3G     51.0M      0.2%      0.0k     72.5M     13.4G     26.9%     66.5M     19.2M     24.0k
20:35:01        31.3G     31.3G     51.1M      0.2%      0.0k     72.5M     13.5G     27.0%     66.5M     19.2M      8.0k
20:45:01        31.3G     31.3G     51.0M      0.2%      0.0k     72.5M     13.4G     26.9%     66.5M     19.2M     12.0k
20:55:01        31.3G     31.3G     48.3M      0.2%      0.0k     72.5M     13.5G     26.9%     63.6M     19.2M     20.0k
21:05:01        31.3G     31.3G     48.3M      0.2%      0.0k     72.5M     13.4G     26.8%     63.7M     19.2M     16.0k
21:15:01        31.3G     31.3G     48.3M      0.2%      0.0k     72.5M     13.5G     26.9%     63.7M     19.2M    340.0k
21:25:01        31.3G     31.3G     48.4M      0.2%      0.0k     72.5M     13.5G     26.9%     63.7M     19.2M      8.0k
21:35:01        31.3G     31.3G     48.4M      0.2%      0.0k     72.5M     13.4G     26.9%     63.7M     19.2M     20.0k
21:45:01        31.3G     31.3G     48.3M      0.2%      0.0k     72.5M     13.4G     26.9%     63.6M     19.2M      4.0k
Average:        31.3G     31.3G     49.0M      0.2%      0.0k     72.5M     13.4G     26.9%     64.4M     19.2M     42.5k

Display data from 20:00 to 21:00.

$ sar -s 20:00 -e 21:00 -r -h
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

20:05:01    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty
20:15:01        31.3G     31.3G     48.1M      0.1%      0.0k     72.5M     13.4G     26.9%     63.6M     19.3M      8.0k
20:25:01        31.3G     31.3G     51.0M      0.2%      0.0k     72.5M     13.4G     26.9%     66.5M     19.2M     24.0k
20:35:01        31.3G     31.3G     51.1M      0.2%      0.0k     72.5M     13.5G     27.0%     66.5M     19.2M      8.0k
20:45:01        31.3G     31.3G     51.0M      0.2%      0.0k     72.5M     13.4G     26.9%     66.5M     19.2M     12.0k
20:55:01        31.3G     31.3G     48.3M      0.2%      0.0k     72.5M     13.5G     26.9%     63.6M     19.2M     20.0k
Average:        31.3G     31.3G     49.9M      0.2%      0.0k     72.5M     13.4G     26.9%     65.4M     19.2M     14.4k

Display data from 04:00 to 05:00 stored in specified file.

$ sar -s 04:00 -e 05:00 -u -f /var/log/sysstat/sa20190328 
Linux 4.18.0-15-generic (debian-test)   03/28/19        _x86_64_        (8 CPU)

04:05:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
04:15:01        all      1.19      0.00      0.87      0.27      0.00     97.67
04:25:01        all      1.37      0.00      0.85      0.27      0.00     97.51
04:35:01        all      1.36      0.00      0.95      0.31      0.00     97.38
04:45:01        all      1.24      0.07      0.85      0.27      0.00     97.57
04:55:01        all      1.19      0.00      0.81      0.26      0.00     97.73
Average:        all      1.27      0.01      0.87      0.28      0.00     97.57