SADF(1)

โœจ NAME โœจ

sadf โ€” literally the tool that displays all the data sar collected, but in like a million different formats ๐Ÿ’… (this is sadf(1) from the Linux User's Manual, hi bestie ๐Ÿซถ)


๐ŸŒธ SYNOPSIS ๐ŸŒธ

sadf [ -C ] [ -c | -d | -g | -j | -l | -p | -r | -x ] [ -H ] [ -h ] [ -T
| -t | -U ] [ -V ] [ -O opts [,...] ] [ -P { cpu_list | ALL } ] [ -s [
start_time ] ] ] [ -e [ end_time ] ] ] [ --dev=dev_list ] [ --fs=fs_list
] [ --iface=iface_list] [ --int=int_list ] [ -- sar_options ] [ interval
[ count ] ] [ datafile | -[0-9]+ ]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so sadf is the main character that shows you what's inside the data files that sar(1) made ๐Ÿ‘‘. But here's the plot twist: unlike sar, sadf can write that data out in so many different formats โ€” CSV, XML, and more โ€” it's giving versatility, honestly. The default format is the kind that pattern-processing commands like awk can handle super easily (peep option -p ๐Ÿ‘€). And sadf can also draw graphs for all the activities sar collected and show them as SVG (Scalable Vector Graphics) graphics right in your web browser (peep option -g ๐ŸŽจ).

sadf extracts those records saved in the datafile file and writes them to standard output. That file has to have been created by a version of sar that's compatible with your version of sadf, no cap โ€” mismatched versions are not the vibe ๐Ÿ˜ญ. If datafile is left out, sadf uses the standard system activity daily data file instead. You can also pass -1, -2 etc. as an argument to sadf to see the data from that many days ago โ€” like, -1 points at yesterday's standard system activity file. Obsessed, actually โœจ.

The standard system activity daily data file is named saDD or saYYYYMMDD, where YYYY is the current year, MM is the current month and DD is the current day. sadf looks for the most recent of saDD and saYYYYMMDD, and uses it. By default it lives in the /var/log/sa directory. But you can point it somewhere else: if datafile is a directory (instead of a plain file), then it gets treated as the directory where the standard system activity daily data file is located ๐Ÿ—‚๏ธ.

The interval and count parameters tell sadf to select count records at interval seconds apart. If count isn't set, then literally all the records saved in the data file get displayed. All of them. The whole thing. ๐Ÿ’€

Here's the part where you gotta be careful bestie ๐Ÿ™ˆ: all the activity flags of sar can be entered on the command line to say which activities get reported. But before you specify them, put a pair of dashes (--) on the command line so the flags don't get confused with sadf's own flags. Not specifying any flags selects only CPU activity โ€” that's the default, periodt.


๐Ÿ’… OPTIONS ๐Ÿ’…

  • -C โ€” Tells sadf to display the comments that are present in the file ๐Ÿ’ฌ.
  • -c โ€” Converts an old system activity binary datafile (version 9.1.6 and later) to the current up-to-date format. Use this syntax, exactly:
sadf -c old_datafile > new_datafile

The conversion can be controlled using option -O (scroll down, it's there ๐Ÿซถ).

  • -d โ€” Prints the contents of the data file in a format that a relational database system can ingest super easily. The output is fields separated by a semicolon. Each record contains the hostname of the host where the file was created, the interval value (or -1 if it's not applicable), the timestamp in a form that most databases will happily accept, plus additional semicolon-separated data fields as specified by the sar_options command line options. Note that the timestamp output can be controlled by options -T, -t and -U โฐ.
  • --dev=dev_list โ€” Specifies the block devices whose statistics sadf should display. dev_list is a list of comma-separated device names. Useful with option -d from sar ๐Ÿ’พ.
  • -e [ hh:mm[:ss] ] -e [ seconds_since_the_epoch ] โ€” Sets the ending time of the report. The default ending time is 18:00:00. Hours must be given in 24-hour format, or as the number of seconds since the epoch (given as a 10 digit number) ๐Ÿ••.
  • --fs=fs_list โ€” Specifies the filesystems whose statistics sadf should display. fs_list is a list of comma-separated filesystem device names and/or mountpoints. Either form is accepted for filtering โ€” both work, iykyk. Useful with option -F from sar ๐Ÿ—„๏ธ.
  • -g โ€” Prints the contents of the data file in SVG (Scalable Vector Graphics) format. This option lets you display some fancy graphs in your web browser ๐ŸŒˆ. Use this syntax:
sadf -g your_datafile [ -- sar_options ] > output.svg

and then open the resulting SVG file in your favorite web browser. The output can be controlled using option -O (again, it's below ๐Ÿ‘‡).

  • -H โ€” Displays only the header of the report (when applicable). If no format has been specified, then the header data (the metadata) of the data file is what gets displayed ๐Ÿท๏ธ.
  • -h โ€” When used together with option -d, all activities get displayed horizontally on a single line. One line. Everything. Slay ๐Ÿ“.
  • --iface=iface_list โ€” Specifies the network interfaces whose statistics sadf should display. iface_list is a list of comma-separated interface names. Useful with options -n DEV and -n EDEV from sar ๐ŸŒ.
  • --int=int_list โ€” Specifies the interrupts names whose statistics sadf should display. int_list is a list of comma-separated values or range of values (e.g., 0-16,35,40-). Useful with option -I from sar โšก.
  • -j โ€” Prints the contents of the data file in JSON (JavaScript Object Notation) format. Timestamps can be controlled by options -T and -t ๐Ÿงพ.
  • -l โ€” Exports the contents of the data file to a PCP (Performance Co-Pilot) archive. The name of the archive can be specified using the keyword pcparchive= with option -O ๐Ÿ“ฆ.
  • -O opts[,...] โ€” Uses the specified options to control the output of sadf. The following options control the SVG output displayed by sadf -g:
    • autoscale โ€” Draws all the graphs of a given view as large as possible based on the current view's scale. To do this, a factor (10, 100, 1000...) is used to enlarge the graph drawing. This option may be interesting when several graphs are drawn on the same view, some with only very small values, and others with high ones โ€” the high ones making the small ones hardly visible ๐Ÿ˜ญ.
    • bwcol โ€” Uses a black and white palette to draw the graphs ๐Ÿ–ค๐Ÿค.
    • customcol โ€” Uses a customizable color palette instead of the default one to draw the graphs. See environment variable S_COLORS_PALETTE below to know how to customize that palette ๐ŸŽจ.
    • debug โ€” Adds helpful comments in the SVG output file ๐Ÿ›.
    • height=value โ€” Sets the SVG canvas height to value ๐Ÿ“.
    • oneday โ€” Displays graphs data over a period of 24 hours. Note that hours are still printed in UTC by default: you should use option -T to print them in local time and get a time window starting from midnight ๐ŸŒ™.
    • packed โ€” Groups all views from the same activity (and for the same device) on the same row ๐Ÿงณ.
    • showidle โ€” Also displays the %idle state in graphs for CPU statistics ๐Ÿ’ค.
    • showinfo โ€” Displays additional information (such as the date and the host name) on each view โ„น๏ธ.
    • showtoc โ€” Adds a table of contents at the beginning of the SVG output, consisting of links pointing at the first graph of each activity ๐Ÿ“‘.
    • skipempty โ€” Does not display views where all graphs have only zero values ๐Ÿšซ.

The following option may be used when converting an old system activity binary datafile to current up-to-date format:

  • hz=value โ€” Specifies the number of ticks per second for the machine where the old datafile has been created โฑ๏ธ.

The following option may be used when data are exported to a PCP archive:

  • pcparchive=name โ€” Specifies the name of the PCP archive to create ๐Ÿ—ƒ๏ธ.

The following option is used to control raw output displayed by sadf -r:

  • debug โ€” Displays additional information, mainly useful for debugging purposes ๐Ÿž.
  • -P { cpu_list | ALL } โ€” Tells sadf that processor-dependent statistics are to be reported only for the specified processor or processors. cpu_list is a list of comma-separated values or range of values (e.g., 0,2,4-7,12-). Note that processor 0 is the first processor, and processor all is the global average among all processors. Specifying the ALL keyword reports statistics for each individual processor, and globally for all processors ๐Ÿ–ฅ๏ธ.
  • -p โ€” Prints the contents of the data file in a format that pattern processing commands like awk can handle super easily. The output is fields separated by a tab. Each record contains the hostname of the host where the file was created, the interval value (or -1 if not applicable), the timestamp, the device name (or - if not applicable), the field name and its value. Note that the timestamp output can be controlled by options -T, -t and -U โฐ.
  • -r โ€” Prints the raw contents of the data file. With this format, the values for all the counters are displayed as read from the kernel, which means e.g. that no average values are calculated over the elapsed time interval โ€” it's the raw realness, no smoothing ๐Ÿงƒ. The output can be controlled using option -O (see above).
  • -s [ hh:mm[:ss] ] -s [ seconds_since_the_epoch ] โ€” Sets the starting time of the report. The default starting time is 08:00:00. Hours must be given in 24-hour format, or as the number of seconds since the epoch (given as a 10 digit number) ๐Ÿ•—.
  • -T โ€” Displays the timestamp in local time instead of UTC (Coordinated Universal Time) ๐Ÿ•ฐ๏ธ.
  • -t โ€” Displays the timestamp in the original local time of the data file creator instead of UTC (Coordinated Universal Time) ๐ŸŒ.
  • -U โ€” Displays the timestamp (UTC โ€” Coordinated Universal Time) in seconds from the epoch ๐Ÿ”ข.
  • -V โ€” Prints the version number then exits. Short and iconic ๐Ÿ‘‹.
  • -x โ€” Prints the contents of the data file in XML format. Timestamps can be controlled by options -T and -t. The corresponding DTD (Document Type Definition) and XML Schema are included in the sysstat source package. They're also available at https://sysstat.github.io/ ๐Ÿ”—.

โœจ ENVIRONMENT โœจ

okay bestie, sadf also peeks at your environment variables ๐Ÿ‘€ here's the whole roster:

  • S_COLORS_PALETTE โ€” this one sets the colors that sadf -g uses to render the SVG output. big caveat: it's only taken into account when you've picked the custom color palette with the option customcol (see option -O). its value is a colon-separated list of capabilities mapped to six-digit, three-byte hexadecimal numbers (hex triplets) representing colors, and it defaults to:
0=000000:1=1a1aff:2=1affb2:3=b21aff:
4=1ab2ff:5=ff1a1a:6=ffb31a:7=b2ff1a:
8=efefef:9=000000:A=1a1aff:B=1affb2:
C=b21aff:D=1ab2ff:E=ff1a1a:F=ffb31a:
G=bebebe:H=000000:I=000000:K=ffffff:
L=000000:T=000000:W=000000:X=000000

capabilities that are just a single hexadecimal digit (0 through F) specify the first sixteen colors in the palette โ€” those are the ones used to draw the graphs ๐ŸŽจ so like, 3=ffffff would mean the third color in the palette is white (0xffffff). the other capabilities are:

  • G= โ€” the color used to draw the grid lines.
  • H= โ€” the color used to display the report header.
  • I= โ€” the color used to display additional information (e.g., date, hostname...).
  • K= โ€” the color used for the graphs background.
  • L= โ€” the default color (which is for example used to display the table of contents).
  • T= โ€” the color used to display the graphs title.
  • W= โ€” the color used to display warning and error messages.
  • X= โ€” the color used to draw the axes and display the graduations.
  • S_TIME_DEF_TIME โ€” if this variable exists and its value is UTC, then sadf will use UTC time instead of local time to figure out which current daily data file lives in the /var/log/sa directory. clock stuff, iykyk ๐Ÿ•ฐ๏ธ

๐ŸŒธ EXAMPLES ๐ŸŒธ

real ones, in action:

sadf -d /var/log/sa/sa21 -- -r -n DEV

extract memory and network statistics from the system activity file sa21, and display them in a format that can be ingested by a database. literally feeding your db, no cap ๐Ÿ’พ

sadf -p -P 1

extract CPU statistics for processor 1 (the second processor, yes, zero-indexed bestie ๐Ÿ˜ญ) from the current daily data file, and display them in a format that can easily be handled by a pattern processing command. grep girlies rejoice ๐Ÿซถ


๐Ÿ’€ BUGS ๐Ÿ’€

so the SVG output (as created by option -g) is fully compliant with the SVG 1.1 standard. graphics have been successfully displayed in various web browsers, including Firefox, Chrome and Opera. but โ€” and I cannot stress this enough โ€” SVG rendering is broken on Microsoft browsers (tested on Internet Explorer 11 and Edge 13.1). so please don't use them. like, don't. I'm begging ๐Ÿ™ˆ


๐ŸŽ€ FILES ๐ŸŽ€

  • /var/log/sa/saDD
  • /var/log/sa/saYYYYMMDD

these are the standard system activity daily data files and their default location. YYYY stands for the current year, MM for the current month and DD for the current day. that's the whole naming scheme, iconic and simple โœจ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Sebastien Godard (sysstat <at> orange.fr) โ€” the main character who made all this happen ๐Ÿ’…


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

sar(1), sadc(8), sa1(8), sa2(8), sysstat(5)

and if you wanna stan further:


okay that's the whole page bestie, you're fully caught up ๐Ÿซถ this one's from the Linux manual, AUGUST 2026, and it's the SADF(1) page โ€” go forth and sadf responsibly, ily, mwah ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from