sma

Langue: en

Version: 304353 (debian - 07/07/09)

Section: 8 (Commandes administrateur)


BSD mandoc

NAME

sma - Sendmail Log Analyser

SYNOPSIS

sma [
OPTIONS ] [file ... ]

DESCRIPTION

The sma utility analyses sendmail log entries and produces a summary of mail activity. sma reads the input from file or from standard input and writes the report to standard output or file.

sma can be configured using command line options or configuration file, or both. Command line options always override the configuration file.

The available command line options are as follows:

-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 sma
-a
Format the report as ASCII.
-b color
Set the background color of the HTML report as color.
-C string
Set report header as string.
-D date1,date2
Process log entry only if the date is between date1 and date2. The format of the date is as follows: [[[[[[cc ] yy ] mm ] dd ] HH ] MM [.SS ] ] where
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, current date is used.

-c
Print the copyright notice and exit.
-d
Process only the domain portion of 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 default configuration file even if it exists.
-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 HTML comment (requires -w or -O html).
-n
Do not report the time distribution.
-o file
Print the report as file. If not given, print 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. 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

sma configuration file consists of keyword-value pairs. Available configuration file keywords and values are listed below.
BgColor RGB
Set HTML report background color as RGB. Command line option: -b
BounceAddress string
Set error message bounce address as string.
CaseSensitive value
Set filter case sensitivity. Possible values are yes or no. This options requires 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 sequencies which are replaced with built-in variables as follows:
%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 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 envelope recipient filter as string. If sma is compiled with USE_REGEXP , 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 string is '!', filter is reversed.
EnvelopeRecipients number
Set the number of the top envelope recipients as number. Command line option: -l
EnvelopeSenderFilter string
Set envelope sender filter as string. See also EnvelopeRecipientFilter keyword.
EnvelopeSenders number
Set the number of the top envelope senders as number. Command line option: -l
FooterText string
Set 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 is 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 report header as string.
HostName string
Set the hostname as string. Normally, HostName is taken from log files, or, in case of Sendmail for NT, from the compile time define HOSTNAME. Command line option: -H
IncludeAscii value
Include the ASCII report as 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 ALT text inside the IMG HTML-tag as string.
PictureLink string
If PictureURL is defined, make the picture as 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 HTML report. The picture appears in a upper left corner of the page. See also PictureParameters , PictureALT and PictureLink keywords.
PrintGeneralInfo value
Print the General Information section in 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 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 relay recipient filter as string. See also EnvelopeRecipientFilter keyword.
RelayRecipients number
Set the number of the top relay recipients as number. Command line option: -r
RelaySenderFilter string
Set relay sender filter as string. See also 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 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 HTML report table corner color as RGB.

FILES

sma can as an option use a configuration file. It's default location can be configured using a compile time define DEFAULT_CONF in file conf.h. By default, it is defined as ./sma.conf

AUTHOR

Jarkko Turkulainen <jt@klake.org>

BUGS

sma takes the year from runtime year. It knows nothing about the new year transitions in log files.

The documentation contains a lot of bad english.