You already know how to collect and report system activity information, so it is the best time to learn how to export already collected data.
I will use sadf
utility to display collected data using multiple different formats. Command invocation is very simple – specify format options, datafile and sar flags.
$ sadf format_options datafile -- sar_flags
Semicolon separated values
Export data using semicolon separated values.
$ sadf -d -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
# hostname;interval;timestamp;tps;rtps;wtps;bread/s;bwrtn/s debian-test;600;2019-04-13 17:45:01 UTC;0.00;0.00;0.00;0.00;0.00 debian-test;600;2019-04-13 17:55:01 UTC;0.08;0.08;0.00;2.12;0.00 debian-test;601;2019-04-13 18:05:01 UTC;0.08;0.08;0.00;4.49;0.00 debian-test;600;2019-04-13 18:15:01 UTC;7.64;7.64;0.00;90.37;0.00 debian-test;600;2019-04-13 18:25:01 UTC;0.00;0.00;0.00;0.00;0.00
Create SVG image
Export data using Scalable Vector Graphics format.
$ sadf -g -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="1060" height="680" fill="black" stroke="gray" stroke-width="1"> <text x="0" y="30" text-anchor="start" stroke="brown">Linux 4.18.0-15-generic (debian-test) 04/13/19 _x86_64_ (8 CPU) </text> <g id="g6-0" transform="translate(0,60)"> <rect x="0" y="0" height="300" width="1050"/> <text x="0" y="20" style="fill: yellow; stroke: none">I/O and transfer rate statistics (1) <tspan x="795" y="25" style="fill: yellow; stroke: none; font-size: 12px">(Min, Max values)</tspan> </text> <polyline points="70,50 70,250 790,250" stroke="white" stroke-width="2"/> <text x="795" y="50" style="fill: #00cc00; stroke: none; font-size: 12px">tps (0.00, 7.64)</text> <text x="795" y="65" style="fill: #ff00bf; stroke: none; font-size: 12px">rtps (0.00, 7.64)</text> <text x="795" y="80" style="fill: #00ffff; stroke: none; font-size: 12px">wtps (0.00, 0.00)</text> <g transform="translate(70,250)"> <text x="0" y="0" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">0.</text> <polyline points="0,2.00 720,2.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-26.172301)"/> <text x="0" y="-52" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">2.</text> <polyline points="0,4.00 720,4.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-26.172301)"/> <text x="0" y="-104" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">4.</text> <polyline points="0,6.00 720,6.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-26.172301)"/> <text x="0" y="-157" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">6.</text> <polyline points="0,0 0,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="0" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,0,0)">17:35:01</text> <polyline points="300,0 300,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="72" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,72,0)">17:40:01</text> <polyline points="600,0 600,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="144" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,144,0)">17:45:01</text> <polyline points="900,0 900,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="216" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,216,0)">17:50:01</text> <polyline points="1200,0 1200,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="288" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,288,0)">17:55:01</text> <polyline points="1500,0 1500,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="360" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,360,0)">18:00:01</text> <polyline points="1800,0 1800,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="432" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,432,0)">18:05:01</text> <polyline points="2100,0 2100,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="504" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,504,0)">18:10:01</text> <polyline points="2400,0 2400,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="576" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,576,0)">18:15:01</text> <polyline points="2700,0 2700,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="648" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,648,0)">18:20:01</text> <polyline points="3000,0 3000,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="720" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,720,0)">18:25:01</text> <text x="-10" y="30" style="fill: yellow; stroke: none; font-size: 12px; text-anchor: end">UTC</text> <path d=" M600,0.00 L1200,0.08 L1800,0.08 L2400,7.64 L3000,0.00" style="vector-effect: non-scaling-stroke; stroke: #00cc00; stroke-width: 1$ fill-opacity: 0" transform="scale(0.240000,-26.172301)"/> <path d=" M600,0.00 L1200,0.08 L1800,0.08 L2400,7.64 L3000,0.00" style="vector-effect: non-scaling-stroke; stroke: #ff00bf; stroke-width: 1$ fill-opacity: 0" transform="scale(0.240000,-26.172301)"/> <path d=" M600,0.00 L1200,0.00 L1800,0.00 L2400,0.00 L3000,0.00" style="vector-effect: non-scaling-stroke; stroke: #00ffff; stroke-width: 1; fill-opacity: 0" transform="scale(0.240000,-26.172301)"/> </g> <rect x="0" y="310" height="300" width="1050"/> <text x="0" y="330" style="fill: yellow; stroke: none">I/O and transfer rate statistics (2) <tspan x="795" y="335" style="fill: yellow; stroke: none; font-size: 12px">(Min, Max values)</tspan> </text> <polyline points="70,360 70,560 790,560" stroke="white" stroke-width="2"/> <text x="795" y="360" style="fill: #ff0000; stroke: none; font-size: 12px">bread/s (0.00, 90.37)</text> <text x="795" y="375" style="fill: #e85f00; stroke: none; font-size: 12px">bwrtn/s (0.00, 0.00)</text> <g transform="translate(70,560)"> <text x="0" y="0" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">0.</text> <polyline points="0,30.00 720,30.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-2.213165)"/> <text x="0" y="-66" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">30.</text> <polyline points="0,60.00 720,60.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-2.213165)"/> <text x="0" y="-132" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">60.</text> <polyline points="0,90.00 720,90.00" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(1,-2.213165)"/> <text x="0" y="-199" style="fill: white; stroke: none; font-size: 12px; text-anchor: end">90.</text> <polyline points="0,0 0,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="0" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,0,0)">17:35:01</text> <polyline points="300,0 300,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="72" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,72,0)">17:40:01</text> <polyline points="600,0 600,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="144" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,144,0)">17:45:01</text> <polyline points="900,0 900,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="216" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,216,0)">17:50:01</text> <polyline points="1200,0 1200,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="288" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,288,0)">17:55:01</text> <polyline points="1500,0 1500,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="360" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,360,0)">18:00:01</text> <polyline points="1800,0 1800,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="432" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,432,0)">18:05:01</text> <polyline points="2100,0 2100,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="504" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,504,0)">18:10:01</text> <polyline points="2400,0 2400,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="576" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,576,0)">18:15:01</text> <polyline points="2700,0 2700,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="648" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,648,0)">18:20:01</text> <polyline points="3000,0 3000,-200" style="vector-effect: non-scaling-stroke; stroke: #202020" transform="scale(0.240000,1)"/> <text x="720" y="10" style="fill: white; stroke: none; font-size: 12px; text-anchor: start" transform="rotate(45,720,0)">18:25:01</text> <text x="-10" y="30" style="fill: yellow; stroke: none; font-size: 12px; text-anchor: end">UTC</text> <path d=" M600,0.00 L1200,2.12 L1800,4.49 L2400,90.37 L3000,0.00" style="vector-effect: non-scaling-stroke; stroke: #ff0000; stroke-width: 1 ; fill-opacity: 0" transform="scale(0.240000,-2.213165)"/> <path d=" M600,0.00 L1200,0.00 L1800,0.00 L2400,0.00 L3000,0.00" style="vector-effect: non-scaling-stroke; stroke: #e85f00; stroke-width: 1; fill-opacity: 0" transform="scale(0.240000,-2.213165)"/> </g> </g> <!-- Actual canvas height: 680 --> </svg>
JSON format
Export data using JavaScript Object Notation format.
$ sadf -j -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
{"sysstat": { "hosts": [ { "nodename": "debian-test", "sysname": "Linux", "release": "4.18.0-15-generic", "machine": "x86_64", "number-of-cpus": 8, "file-date": "2019-04-13", "file-utc-time": "00:00:01", "statistics": [ { "timestamp": {"date": "2019-04-13", "time": "17:45:01", "utc": 1, "interval": 600}, "io": {"tps": 0.00, "io-reads": {"rtps": 0.00, "bread": 0.00}, "io-writes": {"wtps": 0.00, "bwrtn": 0.00}} }, { "timestamp": {"date": "2019-04-13", "time": "17:55:01", "utc": 1, "interval": 600}, "io": {"tps": 0.08, "io-reads": {"rtps": 0.08, "bread": 2.12}, "io-writes": {"wtps": 0.00, "bwrtn": 0.00}} }, { "timestamp": {"date": "2019-04-13", "time": "18:05:01", "utc": 1, "interval": 601}, "io": {"tps": 0.08, "io-reads": {"rtps": 0.08, "bread": 4.49}, "io-writes": {"wtps": 0.00, "bwrtn": 0.00}} }, { "timestamp": {"date": "2019-04-13", "time": "18:15:01", "utc": 1, "interval": 600}, "io": {"tps": 7.64, "io-reads": {"rtps": 7.64, "bread": 90.37}, "io-writes": {"wtps": 0.00, "bwrtn": 0.00}} }, { "timestamp": {"date": "2019-04-13", "time": "18:25:01", "utc": 1, "interval": 600}, "io": {"tps": 0.00, "io-reads": {"rtps": 0.00, "bread": 0.00}, "io-writes": {"wtps": 0.00, "bwrtn": 0.00}} }, { } ], "restarts": [ ] } ] }}
Tab separated values
Export data using tab separated values.
$ sadf -p -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
debian-test 600 2019-04-13 17:45:01 UTC - tps 0.00 debian-test 600 2019-04-13 17:45:01 UTC - rtps 0.00 debian-test 600 2019-04-13 17:45:01 UTC - wtps 0.00 debian-test 600 2019-04-13 17:45:01 UTC - bread/s 0.00 debian-test 600 2019-04-13 17:45:01 UTC - bwrtn/s 0.00 debian-test 600 2019-04-13 17:55:01 UTC - tps 0.08 debian-test 600 2019-04-13 17:55:01 UTC - rtps 0.08 debian-test 600 2019-04-13 17:55:01 UTC - wtps 0.00 debian-test 600 2019-04-13 17:55:01 UTC - bread/s 2.12 debian-test 600 2019-04-13 17:55:01 UTC - bwrtn/s 0.00 debian-test 601 2019-04-13 18:05:01 UTC - tps 0.08 debian-test 601 2019-04-13 18:05:01 UTC - rtps 0.08 debian-test 601 2019-04-13 18:05:01 UTC - wtps 0.00 debian-test 601 2019-04-13 18:05:01 UTC - bread/s 4.49 debian-test 601 2019-04-13 18:05:01 UTC - bwrtn/s 0.00 debian-test 600 2019-04-13 18:15:01 UTC - tps 7.64 debian-test 600 2019-04-13 18:15:01 UTC - rtps 7.64 debian-test 600 2019-04-13 18:15:01 UTC - wtps 0.00 debian-test 600 2019-04-13 18:15:01 UTC - bread/s 90.37 debian-test 600 2019-04-13 18:15:01 UTC - bwrtn/s 0.00 debian-test 600 2019-04-13 18:25:01 UTC - tps 0.00 debian-test 600 2019-04-13 18:25:01 UTC - rtps 0.00 debian-test 600 2019-04-13 18:25:01 UTC - wtps 0.00 debian-test 600 2019-04-13 18:25:01 UTC - bread/s 0.00 debian-test 600 2019-04-13 18:25:01 UTC - bwrtn/s 0.00
XML format
Export data using Extensible Markup Language format.
$ sadf -x -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
<sysstat xmlns_xsi="http://www.w3.org/2001/XMLSchema-instance" xsi_schemaLocation="http://pagesperso-orange.fr/sebastien.godard sysstat.xsd"> <sysdata-version>3.4</sysdata-version> <host nodename="debian-test"> <sysname>Linux</sysname> <release>4.18.0-15-generic</release> <machine>x86_64</machine> <number-of-cpus>8</number-of-cpus> <file-date>2019-04-13</file-date> <file-utc-time>00:00:01</file-utc-time> <statistics> <timestamp date="2019-04-13" time="17:45:01" utc="1" interval="600"> <io per="second"> <tps>0.00</tps> <io-reads rtps="0.00" bread="0.00"/> <io-writes wtps="0.00" bwrtn="0.00"/> </io> </timestamp> <timestamp date="2019-04-13" time="17:55:01" utc="1" interval="600"> <io per="second"> <tps>0.08</tps> <io-reads rtps="0.08" bread="2.12"/> <io-writes wtps="0.00" bwrtn="0.00"/> </io> </timestamp> <timestamp date="2019-04-13" time="18:05:01" utc="1" interval="601"> <io per="second"> <tps>0.08</tps> <io-reads rtps="0.08" bread="4.49"/> <io-writes wtps="0.00" bwrtn="0.00"/> </io> </timestamp> <timestamp date="2019-04-13" time="18:15:01" utc="1" interval="600"> <io per="second"> <tps>7.64</tps> <io-reads rtps="7.64" bread="90.37"/> <io-writes wtps="0.00" bwrtn="0.00"/> </io> </timestamp> <timestamp date="2019-04-13" time="18:25:01" utc="1" interval="600"> <io per="second"> <tps>0.00</tps> <io-reads rtps="0.00" bread="0.00"/> <io-writes wtps="0.00" bwrtn="0.00"/> </io> </timestamp> </statistics> <restarts> </restarts> </host> </sysstat>
RAW data
Export raw as read from the kernel data.
$ sadf -r -s 17:30 -e 18:30 /var/log/sysstat/sa20190413 -- -b
17:45:01 UTC; tps; 3184; 3185; rtps; 3184; 3185; wtps; 0; 0; bread/s; 49673; 49674; bwrtn/s; 0; 0; 17:55:01 UTC; tps; 3185; 3232; rtps; 3185; 3232; wtps; 0; 0; bread/s; 49674; 50944; bwrtn/s; 0; 0; 18:05:01 UTC; tps; 3232; 3281; rtps; 3232; 3281; wtps; 0; 0; bread/s; 50944; 53642; bwrtn/s; 0; 0; 18:15:01 UTC; tps; 3281; 7866; rtps; 3281; 7866; wtps; 0; 0; bread/s; 53642; 107863; bwrtn/s; 0; 0; 18:25:01 UTC; tps; 7866; 7868; rtps; 7866; 7868; wtps; 0; 0; bread/s; 107863; 107863; bwrtn/s; 0; 0;