SA2(8)

๐Ÿ’… SA2(8) โ€” your girl's guide to sa2

okay so real talk, we're in the Linux User's Manual, section 8 (that's the admin-commands section, iykyk), and today's main character is sa2. buckle up bestie ๐ŸŽ€


โœจ NAME โœจ

sa2 โ€” makes a report out of the current standard system activity daily data file. that's it, that's the gig ๐Ÿ’–


๐ŸŒธ SYNOPSIS ๐ŸŒธ

/usr/lib/sa/sa2

literally just that path, no cap. she lives at /usr/lib/sa/sa2 and she takes flags (more on that in a sec) ๐Ÿฆ‹


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so sa2 is a shell procedure variant of the sar command โ€” like, sar's cute cousin who's got her own whole thing going on. what she does is write a daily report into the sarDD file, or the sarYYYYMMDD file, and here's the decoder ring:

  • YYYY = the current year
  • MM = the current month
  • DD = the current day

by default that report is saved in the /var/log/sa directory. iconic. ๐Ÿ’…

and she's not just a report-girlie, she's also a little bit of a cleaner: sa2 will also remove reports more than one week old, by default. yes bestie, she declutters for you ๐Ÿงนโœจ but like โ€” you can keep reports for a longer (or a shorter) period by setting the HISTORY environment variable. that's the whole vibe check. read the sysstat(5) manual page for details, because yours truly is not gonna recite it all here ๐Ÿ™ˆ

oh and also โ€” the sa2 command accepts most of the flags and parameters of the sar command. so all your sar muscle memory? transfers. slay. ๐Ÿ”ฅ

and the big one: sa2 is designed to be started automatically by the cron command. she's a set-it-and-forget-it queen ๐Ÿ‘‘


โญ EXAMPLES โญ

wanna run sa2 daily? obviously. place the following entry in your root crontab file:

5 19 * * 1-5 /usr/lib/sa/sa2 -A

and that, by default, will generate a daily report called sarDD in the /var/log/sa directory โ€” where the DD parameter is a number representing the day of the month. cute right? ๐Ÿ“

ngl, that's the root crontab specifically โ€” don't go putting it in your own user crontab and then wondering why nothing happened ๐Ÿ˜ญ

๐ŸŽ€ FILES ๐ŸŽ€

  • /var/log/sa/sarDD
  • /var/log/sa/sarYYYYMMDD

these are the standard system activity daily report files, and this is their default location. again for the people in the back: YYYY stands for the current year, MM for the current month, and DD for the current day. ๐Ÿ’œ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Sebastien Godard (sysstat <at> orange.fr) โ€” thank you for your service king ๐Ÿซถ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

and if you wanna go deeper (you do, I know you):


okay that's the whole page!! ๐Ÿ’– this one shipped from the Linux release of the manual, dated AUGUST 2023, and it's filed under SA2(8) โ€” so go forth, cron her up, and let the daily reports come to you. mwah ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from