.Dd October 28, 2001 .Dt SMA 8 .Os .Sh NAME .Nm sma .Nd Sendmail Log Analyser .Sh SYNOPSIS .Nm sma .Op Nm OPTIONS .Op Ar .Sh DESCRIPTION The .Nm utility analyses sendmail log entries and produces a summary of mail activity. .Nm reads the input from .Ar file or from standard input and writes the report to standard output or file. .Pp .Nm can be configured using command line options or configuration file, or both. Command line options always override the configuration file. .Pp The available command line options are as follows: .Bl -tag -width Ds .It Fl A Downcase all addresses. This is so that foo@bar.com is equivilant to FOO@BAR.Com and Foo@Bar.com and they all get counted the same in the counts. Usually one is interested in the user, not the format of the address and since email addresses are case insensitive to MTAs, one may want to make them case insensitive in .Nm .It Fl a Format the report as ASCII. .It Fl b Ar color Set the background color of the HTML report as .Ar color. .It Fl C Ar string Set report header as .Ar string. .It Fl D Ar date1,date2 Process log entry only if the date is between .Ar date1 and .Ar date2. The format of the date is as follows: .Sm off .Oo Oo Oo Oo Oo Oo .Ar cc Oc .Ar yy Oc .Ar mm Oc .Ar dd Oc .Ar HH Oc .Ar MM Op Ar \&.SS Oc .Sm on where .Pp .Bl -tag -width Ds -compact -offset indent .It Ar yy Year in abbreviated form (for years 1969-2068). The format .Ar ccyymmddHHMM is also permitted, for non-ambiguous years. .It Ar mm Numeric month, a number from 1 to 12. .It Ar dd Day, a number from 1 to 31. .It Ar HH Hour, a number from 0 to 23. .It Ar MM Minute, a number from 0 to 59. .It Ar SS Second, a number from 0 to 61 (59 plus a maximum of two leap seconds). .El .Pp 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, current date is used. .Pp .It Fl c Print the copyright notice and exit. .It Fl d Process only the domain portion of email address. .It Fl f Ar file Read the configuration from .Ar file instead of the default configuration file. The default configuration file is defined in conf.h. .It Fl F Do not use default configuration file even if it exists. .It Fl H Ar name Use .Ar name as hostname. .It Fl L Ar string Process only lines with syslog tag .Ar string .It Fl h Print help message and exit. .It Fl i Include the ASCII report as HTML comment (requires -w or -O html). .It Fl n Do not report the time distribution. .It Fl o Ar file Print the report as .Ar file. If not given, print to stdout. .It Fl O Ar format Format the report as .Ar format. Possible values for .Ar format are ascii, html and clog. .It Fl p Print current configuration to stdout. .It Fl s Sort by transfers. Default is by number of messages. .It Fl t Ar value Adjust the internal hash table size. Possible values for .Ar value are normal, big and huge. .It Fl q Do not print any warning messages. .It Fl l Ar num Number of the top senders and recipients in the report. Default is 10. .It Fl r Ar num Number of the top relay senders and recipients in the report. Default is 5. .It Fl v Print some debugging information for each parsed line. .It Fl w Format the report as HTML. .El .Sh KEYWORDS .Nm configuration file consists of keyword-value pairs. Available configuration file keywords and values are listed below. .Pp .Bl -tag -width indent .It Nm BgColor Ar RGB Set HTML report background color as .Ar RGB. Command line option: .Fl b .It Nm BounceAddress Ar string Set error message bounce address as .Ar string. .It Nm CaseSensitive Ar value Set filter case sensitivity. Possible values are .Ar yes or .Ar no. This options requires .Nm USE_REGEXP compile time definition. .It Nm DowncaseAddresses Ar value Set whether or not to make all addresses lower case, to make counts for users more accurate. Possible values are .Ar yes or .Ar no. .It Nm ClogFormat Ar string Formatting string for Custom Log format. .Ar format consists of ordinary characters and various two-character sequencies which are replaced with built-in variables as follows: .Bl -tag -width indent .It Nm \&%U time in UNIX time format .It Nm \&%D time in form "Wed Jun 30 21:49:08 1993" .It Nm %y year, four digits .It Nm %m month, in digits .It Nm %M month, three letter English .It Nm %n minute .It Nm %s second .It Nm %d day .It Nm %h hour .It Nm %H hostname .It Nm %z size in bytes .It Nm %f envelope sender .It Nm %t envelope recipient .It Nm %F relay sender .It Nm \&%T relay recipient .It Nm %S status (1 = sent, 0 = error) .It Nm %\i message id .It Nm %% %-character .It Nm \en newline .It Nm \et tab stop .It Nm \e\e single backslash .El .It Nm ClogSentOnly Ar value If .Ar value is set as .Ar yes , print only sent messages (status = 1). .It Nm Comment Ar string Set report header as .Ar string. Command line option: .Fl C .It Nm Debug Ar value If .Ar value is set as .Ar yes , print debugging information to stderr. Command line option: .Fl v .It Nm EndTime Ar date Process log entry only if the date is before .Ar date. The format of the .Ar date is .Nm YYYY/MM/DD-HH:MM:SS. Command line option: .Fl D .It Nm EnvelopePairs Ar number Set the number of the top envelope pairs as .Ar number. .It Nm EnvelopeRecipientFilter Ar string Set envelope recipient filter as .Ar string. If .Nm sma is compiled with .Nm USE_REGEXP , .Ar string can be regular expression of syntax defined in re_format(7). Otherwise the standard C library function strstr() is used. If the first character of .Ar string is '!', filter is reversed. .It Nm EnvelopeRecipients Ar number Set the number of the top envelope recipients as .Ar number. Command line option: .Fl l .It Nm EnvelopeSenderFilter Ar string Set envelope sender filter as .Ar string. See also .Nm EnvelopeRecipientFilter keyword. .It Nm EnvelopeSenders Ar number Set the number of the top envelope senders as .Ar number. Command line option: .Fl l .It Nm FooterText Ar string Set report footer as .Ar string. .It Nm Format Ar string Set the output format as .Ar string. Possible values are .Ar ascii , .Ar html and .Ar clog. Command line options: .Fl a , .Fl w and .Fl O .It Nm HashTables Ar string Adjust the internal hash table size. Possible values are .Ar normal , .Ar big and .Ar huge. It is also possible to specify a custom hash table size by defining two values and separating them with a comma ','. Command line option: .Fl t .It Nm HeaderText Ar string Set report header as .Ar string. .It Nm HostName Ar string Set the hostname as .Ar string. Normally, HostName is taken from log files, or, in case of Sendmail for NT, from the compile time define HOSTNAME. Command line option: .Fl H .It Nm IncludeAscii Ar value Include the ASCII report as HTML comment. Possible values are .Ar yes or .Ar no. Command line option: .Fl i .It Nm OutFile Ar file Print the report as .Ar file. Command line option: .Fl o .It Nm PictureALT Ar string If .Nm PictureURL is defined, set ALT text inside the IMG HTML-tag as .Ar string. .It Nm PictureLink Ar string If .Nm PictureURL is defined, make the picture as link pointing to .Ar string. .It Nm PictureParameters Ar string If .Nm PictureURL is defined, set additional IMG parameters as .Ar string. .It Nm PictureURL Ar URL Include a picture with source URL as .Ar URL in HTML report. The picture appears in a upper left corner of the page. See also .Nm PictureParameters , .Nm PictureALT and .Nm PictureLink keywords. .It Nm PrintGeneralInfo Ar value Print the General Information section in report. Possible values are .Ar yes or .Ar no. .It Nm PrintStatus Ar number Set the number of the top status messages as .Ar number. .It Nm PrintRule Ar number Set the number of the top ruleset rejections as .Ar number. .It Nm PrintTime Ar value Print the Time Distribution section in report. Possible values are .Ar yes or .Ar no. Command line option: .Fl n .It Nm RelayPairs Ar number Set the number of the top relay address pairs as .Ar number. .It Nm RelayRecipientFilter Ar string Set relay recipient filter as .Ar string. See also .Nm EnvelopeRecipientFilter keyword. .It Nm RelayRecipients Ar number Set the number of the top relay recipients as .Ar number. Command line option: .Fl r .It Nm RelaySenderFilter Ar string Set relay sender filter as .Ar string. See also .Nm EnvelopeRecipientFilter keyword. .It Nm RelaySenders Ar number Set the number of the top relay senders as .Ar number. Command line option: .Fl r .It Nm ShowUsers Ar value If .Ar value is set as .Ar no , process only the domain portion of the email address. Command line option: .Fl d .It Nm Silent Ar value If .Ar value is set as .Ar yes , do not print error messages. Command line option: .Fl q .It Nm Sorting Ar value Set the sort order as .Ar value. Possible values are .Ar number or .Ar transfer. Command line option: .Fl s .It Nm SyslogTag Ar string Process only lines with syslog tag .Ar string. Command line option: .Fl L .It Nm StartTime Ar date Process log entry only if the date is after .Ar date. The format of the .Ar date is .Nm YYYY/MM/DD-HH:MM:SS. Command line option: .Fl D .It Nm TbColor Ar RGB Set HTML report table corner color as .Ar RGB. .El .Sh FILES .Nm sma can as an option use a configuration file. It's default location can be configured using a compile time define .Nm DEFAULT_CONF in file conf.h. By default, it is defined as .Nm ./sma.conf .Sh AUTHOR Jarkko Turkulainen .Sh BUGS .Nm takes the year from runtime year. It knows nothing about the new year transitions in log files. .Pp The documentation contains a lot of bad english.