File: sma.8

package info (click to toggle)
sma 1.4-3.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 620 kB
  • sloc: ansic: 6,291; sh: 163; perl: 148; makefile: 67
file content (448 lines) | stat: -rw-r--r-- 9,568 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
.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 <jt@klake.org>
.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.