SMA(8)

πŸ’Œ NAME πŸ’Œ

okay so, this is sma(8) β€” the System Manager's Manual page for sma, aka the Sendmail Log Analyser. say hi bestie 🫢


✨ SYNOPSIS ✨

sma [OPTIONS] [file ...]

πŸ¦‹ DESCRIPTION πŸ¦‹

so sma reads sendmail log entries and spits out a whole summary of your mail activity. it takes input from a file or from standard input, and it writes the report to standard output or to a file. simple, clean, iconic πŸ’…

you can configure sma with command line options, or with a configuration file, or both at once β€” but heads up, command line options always win over the configuration file. no cap, they override every time. πŸ‘‘


πŸ’… OPTIONS πŸ’…

here's the full menu of command line flags, no skips, we're doing all of them:

  • -A β€” downcase all addresses. this is so foo@bar.com is equivalent to FOO@BAR.Com and Foo@Bar.com and they all get counted the same in the counts. usually you're interested in the user, not the format of the address, and since email addresses are case insensitive to MTAs, you might want to make them case insensitive in sma too. ✨
  • -a β€” format the report as ASCII.
  • -b color β€” set the background color of the HTML report as color. 🎨
  • -C string β€” set the report header as string.
  • -D date1,date2 β€” process a log entry only if the date is between date1 and date2. the date format is literally this:
[[[[[[cc]yy]mm]dd]HH]MM[.SS]]

and the parts go like:

  • yy β€” year in abbreviated form (for years 1969-2068). the format ccyymmddHHMM is also permitted, for non-ambiguous years.
  • mm β€” numeric month, a number from 1 to 12.
  • dd β€” day, a number from 1 to 31.
  • HH β€” hour, a number from 0 to 23.
  • MM β€” minute, a number from 0 to 59.
  • SS β€” second, a number from 0 to 61 (59 plus a maximum of two leap seconds).

everything but the minute is optional. the dates must be separated using a colon, without any whitespace characters. if either of the dates is missing, the current date is used. πŸ•°οΈ

  • -c β€” print the copyright notice and exit.
  • -d β€” process only the domain portion of the email address.
  • -f file β€” read the configuration from file instead of the default configuration file. the default configuration file is defined in conf.h.
  • -F β€” do not use the default configuration file even if it exists. bold. πŸ™ˆ
  • -H name β€” use name as hostname.
  • -L string β€” process only lines with syslog tag string.
  • -h β€” print help message and exit.
  • -i β€” include the ASCII report as an HTML comment (this requires -w or -O html). ⚠️
  • -n β€” do not report the time distribution.
  • -o file β€” print the report as file. if it's not given, it prints to stdout.
  • -O format β€” format the report as format. possible values for format are ascii, html and clog.
  • -p β€” print current configuration to stdout. 🫢
  • -s β€” sort by transfers. the default is by number of messages.
  • -t value β€” adjust the internal hash table size. possible values for value are normal, big and huge.
  • -q β€” do not print any warning messages. 🀫
  • -l num β€” number of the top senders and recipients in the report. default is 10.
  • -r num β€” number of the top relay senders and recipients in the report. default is 5.
  • -v β€” print some debugging information for each parsed line. πŸ”
  • -w β€” format the report as HTML.

πŸŽ€ KEYWORDS πŸŽ€

the sma configuration file is made of keyword-value pairs. here's every available configuration file keyword and value, in order, because we don't gatekeep here:

  • BgColor RGB β€” set the HTML report background color as RGB. command line option: -b
  • BounceAddress string β€” set the error message bounce address as string.
  • CaseSensitive value β€” set filter case sensitivity. possible values are yes or no. this option requires the USE_REGEXP compile time definition.
  • DowncaseAddresses value β€” set whether or not to make all addresses lower case, to make counts for users more accurate. possible values are yes or no.
  • ClogFormat string β€” formatting string for Custom Log format. format consists of ordinary characters and various two-character sequences which get replaced with built-in variables, like so:
    • %U β€” time in UNIX time format
    • %D β€” time in form "Wed Jun 30 21:49:08 1993"
    • %y β€” year, four digits
    • %m β€” month, in digits
    • %M β€” month, three letter English
    • %n β€” minute
    • %s β€” second
    • %d β€” day
    • %h β€” hour
    • %H β€” hostname
    • %z β€” size in bytes
    • %f β€” envelope sender
    • %t β€” envelope recipient
    • %F β€” relay sender
    • %T β€” relay recipient
    • %S β€” status (1 = sent, 0 = error)
    • %i β€” message id
    • %% β€” %-character
    • \n β€” newline
    • \t β€” tab stop
    • \\ β€” single backslash
  • ClogSentOnly value β€” if value is set as yes, print only sent messages (status = 1).
  • Comment string β€” set report header as string. command line option: -C
  • Debug value β€” if value is set as yes, print debugging information to stderr. command line option: -v
  • EndTime date β€” process a log entry only if the date is before date. the format of the date is YYYY/MM/DD-HH:MM:SS. command line option: -D
  • EnvelopePairs number β€” set the number of the top envelope pairs as number.
  • EnvelopeRecipientFilter string β€” set the envelope recipient filter as string. if sma is compiled with USE_REGEXP, string can be a regular expression of the syntax defined in re_format(7). otherwise the standard C library function strstr() is used. if the first character of string is '!', the filter is reversed. πŸ”„
  • EnvelopeRecipients number β€” set the number of the top envelope recipients as number. command line option: -l
  • EnvelopeSenderFilter string β€” set the envelope sender filter as string. see also the EnvelopeRecipientFilter keyword.
  • EnvelopeSenders number β€” set the number of the top envelope senders as number. command line option: -l
  • FooterText string β€” set the report footer as string.
  • Format string β€” set the output format as string. possible values are ascii, html and clog. command line options: -a, -w and -O
  • HashTables string β€” adjust the internal hash table size. possible values are normal, big and huge. it's also possible to specify a custom hash table size by defining two values and separating them with a comma ','. command line option: -t
  • HeaderText string β€” set the report header as string.
  • HostName string β€” set the hostname as string. normally, HostName is taken from log files, or, in the case of Sendmail for NT, from the compile time define HOSTNAME. command line option: -H
  • IncludeAscii value β€” include the ASCII report as an HTML comment. possible values are yes or no. command line option: -i
  • OutFile file β€” print the report as file. command line option: -o
  • PictureALT string β€” if PictureURL is defined, set the ALT text inside the IMG HTML-tag as string.
  • PictureLink string β€” if PictureURL is defined, make the picture a link pointing to string.
  • PictureParameters string β€” if PictureURL is defined, set additional IMG parameters as string.
  • PictureURL URL β€” include a picture with source URL as URL in the HTML report. the picture appears in the upper left corner of the page. see also the PictureParameters, PictureALT and PictureLink keywords. πŸ–ΌοΈ
  • PrintGeneralInfo value β€” print the General Information section in the report. possible values are yes or no.
  • PrintStatus number β€” set the number of the top status messages as number.
  • PrintRule number β€” set the number of the top ruleset rejections as number.
  • PrintTime value β€” print the Time Distribution section in the report. possible values are yes or no. command line option: -n
  • RelayPairs number β€” set the number of the top relay address pairs as number.
  • RelayRecipientFilter string β€” set the relay recipient filter as string. see also the EnvelopeRecipientFilter keyword.
  • RelayRecipients number β€” set the number of the top relay recipients as number. command line option: -r
  • RelaySenderFilter string β€” set the relay sender filter as string. see also the EnvelopeRecipientFilter keyword.
  • RelaySenders number β€” set the number of the top relay senders as number. command line option: -r
  • ShowUsers value β€” if value is set as no, process only the domain portion of the email address. command line option: -d
  • Silent value β€” if value is set as yes, do not print error messages. command line option: -q
  • Sorting value β€” set the sort order as value. possible values are number or transfer. command line option: -s
  • SyslogTag string β€” process only lines with syslog tag string. command line option: -L
  • StartTime date β€” process a log entry only if the date is after date. the format of the date is YYYY/MM/DD-HH:MM:SS. command line option: -D
  • TbColor RGB β€” set the HTML report table corner color as RGB. ✨

🌸 FILES 🌸

sma can, as an option, use a configuration file. its default location can be configured using the compile time define DEFAULT_CONF in the file conf.h. by default, it is defined as ./sma.conf. πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

Jarkko Turkulainen <jt@klake.org> β€” thank you for your service king 🫑


πŸ’€ BUGS πŸ’€

okay so, the tea: sma takes the year from the runtime year. it knows nothing about the new year transitions in log files. like, nothing nothing. 😭
also, and I quote, the documentation contains a lot of bad english. we've all been there bestie, no judgement πŸ’€

and that's the whole page!! this was the SMA(8) page, straight out of the System Manager's Manual, shipped by Debian, dated October 28, 2001. periodt. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from