]> gitweb.michael.orlitzky.com - postfix-logwatch.git/blob - postfix-logwatch.1
Changes: add the one change in v1.40.05.
[postfix-logwatch.git] / postfix-logwatch.1
1 .TH POSTFIX-LOGWATCH 1
2 .ad
3 .fi
4 .SH NAME
5 postfix-logwatch
6 \-
7 A Postfix log parser and analysis utility
8 .SH "SYNOPSIS"
9 .na
10 .nf
11 .fi
12 \fBpostfix-logwatch\fR [\fIoptions\fR] [\fIlogfile ...\fR]
13 .SH DESCRIPTION
14 .ad
15 .fi
16 The \fBpostfix-logwatch\fR(1) utility is a Postfix MTA log parser
17 that produces summaries, details, and statistics regarding
18 the operation of Postfix.
19 .PP
20 This utility can be used as a
21 standalone program, or as a Logwatch filter module to produce
22 Postfix summary and detailed reports from within Logwatch.
23 .PP
24 \fBPostfix-logwatch\fR is able to produce
25 a wide range of reports with data grouped and sorted as much as possible
26 to reduce noise and highlight patterns.
27 Brief summary reports provide a
28 quick overview of general Postfix operations and message
29 delivery, calling out warnings that may require attention.
30 Detailed reports provide easy to scan, hierarchically-arranged
31 and organized information, with as much or little detail as
32 desired.
33 .PP
34 \fBPostfix-logwatch\fR outputs two principal sections: a \fBSummary\fR section
35 and a \fBDetailed\fR section.
36 For readability and quick scanning, all event or hit counts appear in the left column,
37 followed by brief description of the event type, and finally additional
38 statistics or count representations may appear in the rightmost column.
39
40 The following segment from a sample Summary report illustrates:
41 .RS 4
42 .nf
43
44 ****** Summary ********************************************
45
46 81 *Warning: Connection rate limit reached (anvil)
47 146 Warned
48
49 68.310M Bytes accepted 71,628,177
50 97.645M Bytes delivered 102,388,245
51 ======== ================================================
52
53 3464 Accepted 41.44%
54 4895 Rejected 58.56%
55 -------- ------------------------------------------------
56 8359 Total 100.00%
57 ======== ================================================
58
59 .fi
60 .RE 0
61 The report warns that anvil's connection rate was hit 81 times,
62 a Postfix access check WARN action was logged 146 times, and
63 a total of 68.310 megabytes (71,628,177 bytes) were accepted
64 into the Postfix system, delivering 97.645 megabytes of
65 data (due to multiple recipients).
66 The Accepted and Rejected lines show that Postfix accepted 3464 (41.44% of the total
67 messages) and rejected 4895 (the remaining 58.56%) of the 8359
68 total messages (temporary rejects show up elsewhere).
69 .PP
70 There are dozens of sub-sections available in the \fBDetailed\fR report, each of
71 whose output can be controlled in various ways.
72 Each sub-section attempts to group and present the most meaningful data at superior levels,
73 while pushing less useful or \fInoisy\fR data towards inferior levels.
74 The goal is to provide as much benefit as possible from smart grouping of
75 data, to allow faster report scanning, pattern identification, and problem solving.
76 Data is always sorted in descending order by count, and then numerically by IP address
77 or alphabetically as appropriate.
78 .PP
79 The following MX errors segment from a sample \fBDetailed\fR report
80 illustrates the basic hierarchical level structure of \fBpostfix-logwatch\fR:
81 .RS 4
82 .nf
83
84 ****** Detailed *******************************************
85
86 261 MX errors --------------------------------------
87 261 Unable to look up MX host
88 222 Host not found
89 73 foolishspammer.local
90 60 completely.bogus.domain.example
91 11 friend.example.com
92 39 No address associated with hostname
93 23 dummymx.sample.net
94 16 pushn.spam.sample.com
95
96 .fi
97 .RE 0
98 .PP
99 The \fBpostfix-logwatch\fR utility reads from STDIN or from the named Postfix
100 \fIlogfile\fR.
101 Multiple \fIlogfile\fR arguments may be specified, each processed
102 in order.
103 The user running \fBpostfix-logwatch\fR must have read permission on
104 each named log file.
105 .PP
106 .SS Options
107 The options listed below affect the operation of \fBpostfix-logwatch\fR.
108 Options specified later on the command line override earlier ones.
109 Any option may be abbreviated to an unambiguous length.
110
111 .IP "\fB-f \fIconfig_file\fR"
112 .PD 0
113 .IP "\fB--config_file \fIconfig_file\fR"
114 .PD
115 Use an alternate configuration file \fIconfig_file\fR instead of
116 the default.
117 This option may be used more than once.
118 Multiple configuration files will be processed in the order presented on the command line.
119 See \fBCONFIGURATION FILE\fR below.
120 .IP "\fB--debug \fIkeywords\fR"
121 Output debug information during the operation of \fBpostfix-logwatch\fR.
122 The parameter \fIkeywords\fR is one or more comma or space separated keywords.
123 To obtain the list of valid keywords, use --debug xxx where xxx is any invalid keyword.
124 .IP "\fB--[no]delays\fR"
125 Enables (disables) output of the message delays percentiles report.
126 The delays percentiles report shows percentiles for each of the 4 delivery latency times reported
127 by Postfix (available in version 2.3 and later) in the form \fBdelays=\fIa\fR/\fIb\fR/\fIc\fR/\fId\fR, where
128 \fIa\fR is the amount of time before the active queue (includes time for previous delivery attempts and time in the deferred queue),
129 \fIb\fR is the amount of time in the active queue up to delivery agent handoff,
130 \fIc\fR is the amount of time spent making connections (including DNS, HELO and TLS) and
131 \fId\fR is the amount of time spent delivering the message.
132 The total delay shown comes from the \fBdelay=\fR field in a message delivery log line.
133
134 \fBNote:\fR This report may consume a large amount of memory; if you have no use for it, disable the delays report.
135
136 .IP "\fB--delays_percentiles \fIp1 [p2 ...]\fR"
137 Specifies the percentiles to be used in the message delays percentiles report.
138 The percentiles \fIp1\fR, \fIp2\fR, \fI...\fR range from 0 to 100, inclusively.
139 The order of the list is not sorted - the report will output the percentiles
140 columns in the order you specify.
141 .IP "\fB--detail \fIlevel\fR"
142 Sets the maximum detail level for \fBpostfix-logwatch\fR to \fIlevel\fR.
143 This option is global, overriding any other output limiters described below.
144
145 The \fBpostfix-logwatch\fR utility
146 produces a \fBSummary\fR section, a \fBDetailed\fR section, and
147 additional report sections.
148 With \fIlevel\fR less than 5, \fBpostfix-logwatch\fR will produce
149 only the \fBSummary\fR section.
150 At \fIlevel\fR 5 and above, the \fBDetailed\fR section, and any
151 additional report sections are candidates for output.
152 Each incremental increase in \fIlevel\fR generates one additional
153 hierarchical sub-level of output in the \fBDetailed\fR section of the report.
154 At \fIlevel\fR 10, all levels are output.
155 Lines that exceed the maximum report width (specified with
156 \fBmax_report_width\fR) will be cut.
157 Setting \fIlevel\fR to 11 will prevent lines in the report from being cut (see also \fB--line_style\fR).
158 .IP "\fB--help\fR"
159 Print usage information and a brief description about command line options.
160 .IP "\fB--ignore_service \fIpattern\fR"
161 Ignore log lines that contain the postfix service name \fBpostfix/\fIservice\fR.
162 The parameter \fIservice\fR is a regular expression.
163
164 \fBNote:\fR if you use parenthesis in your regular expression, be sure they are cloistering
165 and not capturing: use \fB(?:\fIpattern\fB)\fR instead of \fB(\fIpattern\fB)\fR.
166 .IP "\fB--ipaddr_width \fIwidth\fR"
167 Specifies that IP addresses in address/hostname pairs should be printed
168 with a field width of \fIwidth\fR characters.
169 Increasing the default may be useful for systems using long IPv6 addresses.
170 .IP "\fB-l limiter=levelspec\fR"
171 .PD 0
172 .IP "\fB--limit limiter=levelspec\fR"
173 .PD
174 Sets the level limiter \fIlimiter\fR with the specification \fIlevelspec\fR.
175 .IP "\fB--line_style \fIstyle\fR"
176 Specifies how to handle long report lines.
177 Three styles are available: \fBfull\fR, \fBtruncate\fR, and \fBwrap\fR.
178 Setting \fIstyle\fR to \fBfull\fR will prevent cutting lines to \fBmax_report_width\fR;
179 this is what occurs when \fBdetail\fR is 11 or higher.
180 When \fIstyle\fR is \fBtruncate\fR (the default),
181 long lines will be truncated according to \fBmax_report_width\fR.
182 Setting \fIstyle\fR to \fBwrap\fR will wrap lines longer than \fBmax_report_width\fR such that
183 left column hit counts are not obscured.
184 This option takes precedence over the line style implied by the \fBdetail\fR level.
185 The options \fB--full\fR, \fB--truncate\fR, and \fB--wrap\fR are synonyms.
186 .IP "\fB--[no]long_queue_ids\fR"
187 Enables (disables) interpretation of long queue IDs in Postfix (>= 2.9) logs.
188 .IP "\fB--nodetail\fR"
189 Disables the \fBDetailed\fR section of the report, and all supplemental reports.
190 This option provides a convenient mechanism to quickly disable all sections
191 under the \fBDetailed\fR report, where subsequent command line
192 options may re-enable one or more sections to create specific reports.
193 .IP "\fB--[no]summary\fR"
194 .IP "\fB--show_summary\fR"
195 Enables (disables) displaying of the the \fBSummary\fR section of the report.
196 The variable Posfix_Show_Summary in used in a configuration file.
197 .IP "\fB--recipient_delimiter \fIdelimiter\fR"
198 Split email delivery addresses using the recipient delimiter character \fIdelimiter\fR.
199 This should generally match
200 the \fBrecipient_delimiter\fR specified in the Postfix parameter
201 file \fBmain.cf\fR, or the default value indicated in
202 \fBpostconf -d recipient_delimiter\fR.
203 This is very useful for obtaining per-alias statistics
204 when a recipient delimeter is used for mail delivery.
205 .IP "\fB--reject_reply_patterns \fIr1 [r2 ...]\fR"
206 Specifies the list of reject reply patterns used to create reject groups.
207 Each entry in the list \fIr1 [r2 ...]\fR must be either a three character
208 regular expression reply code of the form [45][0-9.][0-9.], or the word "Warn".
209 The "." in the regular expression is a literal dot which matches any reject reply subcode;
210 this wildcarding allows creation of broad rejects groups.
211 List order is preserved, in that reject reports will be output in the same order as
212 the entries in the list.
213 Specific reject reply codes will take priority over wildcard patterns, regardless of
214 the list order.
215
216 The default list is "5.. 4.. Warn", which creates three groups of rejects:
217 permanent rejects, temporary reject failures, and reject warnings (as in warn_if_reject).
218
219 This feature allows, for example, distinguishing 421 transmission
220 channel closures from 45x errors (eg. 450 mailbox unavailable, 451
221 local processing errors, 452 insufficient storage).
222 Such a grouping would be configured with the list: "421 4.. 5.. Warn".
223 See RFC 2821 for more information about reply codes.
224
225 See also \fBCONFIGURATION FILE\fR regarding using \fBreject_reply_patterns\fR within a configuration file.
226 .IP "\fB--[no]sect_vars\fR"
227 .PD 0
228 .IP "\fB--show_sect_vars \fIboolean\fR"
229 .PD
230 Enables (disables) supplementing each \fBDetailed\fR section title
231 with the name of that section's level limiter.
232 The name displayed is the command line option (or configuration
233 file variable) used to limit that section's output.
234 .
235 With the large number of level limiters available in \fBpostfix-logwatch\fR,
236 this a convenient mechanism for determining exactly which level limiter
237 affects a section.
238 .IP "\fB--syslog_name \fInamepat\fR"
239 Specifies the syslog service name that \fBpostfix-logwatch\fR uses
240 to match syslog lines.
241 Only log lines whose service name matches
242 the perl regular expression \fInamepat\fR will be used by
243 \fBpostfix-logwatch\fR; all non-matching lines are silently ignored.
244 This is useful when a pre-installed Postfix package uses a name
245 other than the default (\fBpostfix\fR), or when multiple Postfix
246 instances are in use and per-instance reporting is desired.
247
248 The pattern \fInamepat\fR should match the \fBsyslog_name\fR configuration
249 parameter specified in the Postfix parameter file \fBmain.cf\fR, the
250 master control file \fBmaster.cf\fR, or the default value as indicated
251 by the output of \fBpostconf -d syslog_name\fR.
252
253 \fBNote:\fR if you use parenthesis in your regular expression, be sure they are cloistering
254 and not capturing: use \fB(?:\fIpattern\fB)\fR instead of \fB(\fIpattern\fB)\fR.
255 .IP "\fB--[no]unknown\fR"
256 .PD 0
257 .IP "\fB--show_unknown \fIboolean\fR"
258 .PD
259 Enables (disables) display of the postfix-generated name of 'unknown' in formated IP/hostname pairs in \fBDetailed\fR reports.
260 Default: enabled.
261 .IP "\fB--version\fR"
262 Print \fBpostfix-logwatch\fR version information.
263 .SS Level Limiters
264 .PP
265 The output of every section in the \fBDetailed\fR report is controlled by a level limiter.
266 The name of the level limiter variable will be output when the \fBsect_vars\fR option is set.
267 Level limiters are set either via command line in standalone mode with \fB--limit \fIlimiter\fB=\fIlevelspec\fR option,
268 or via configuration file variable \fB$postfix_\fIlimiter\fB=\fIlevelspec\fR.
269 Each limiter requires a \fIlevelspec\fR argument, which is described below in \fBLEVEL CONTROL\fR.
270
271 The list of level limiters is shown below.
272
273 There are several level limiters that control reject sub-sections (eg. \fBrejectbody\fR, \fBrejectsender\fR, etc.).
274 Because the list of reject variants is not known until runtime after \fBreject_reply_patterns\fR is seen, these reject limiters are shown below generically,
275 with the prefix \fB###\fR.
276 To use one of these reject limiters, substitute \fB###\fR with one of the reject reply codes in effect,
277 replacing each dot with an \fBx\fR character.
278 For example, using the default \fBreject_reply_patterns\fR list of "5.. 4.. Warn", three \fBrejectbody\fR variants are valid:
279 \fB--limit 5xxrejectbody\fR, \fB--limit 4xxrejectbody\fR and \fB--limit warnrejectbody\fR.
280 As a convenience, you may entirely eliminate the \fB###\fR prefix, and instead use the bare \fBreject\fIXXX\fR option, and
281 all reject level limiter variations will be auto-generated based on the \fBreject_reply_patterns\fR list.
282 For example, the command line segment:
283 .nf
284
285 ... --reject_reply_patterns "421 5.." \\
286 --limit rejectrbl="1:10:"
287
288 .fi
289 would automatically become:
290 .nf
291
292 ... --reject_reply_patterns "421 5.." \\
293 --limit 421rejectrbl="1:10:" --limit 5xxrejectrbl="1:10:"
294
295 .fi
296 See \fBreject_reply_patterns\fR above, and comments in the configuration file \fBpostfix-logwatch.conf\fR.
297
298 .de TQ
299 . br
300 . ns
301 . TP \\$1
302 ..
303
304 [ THIS SECTION IS NOT YET COMPLETE ]
305
306 .PD 0
307 .IP "\fBAttrError"
308 Errors obtaining attribute data from service.
309 .IP "\fBBCCed"
310 Messages that triggered access, header_checks or body_checks BCC action. (postfix 2.6 experimental branch)
311 .IP "\fBBounceLocal"
312 .IP "\fBBounceRemote"
313 Local and remote bounces.
314 A bounce is considered a local bounce if the relay was one of none, local, virtual,
315 avcheck, maildrop or 127.0.0.1.
316 .IP "\fBByIpRejects"
317 Regrouping by client host IP address of all 5xx (permanent) reject variants.
318 .IP "\fBCommunicationError"
319 Postfix errors talking to one of its services.
320 .IP "\fBAnvil"
321 Anvil rate or concurrency limits.
322 .IP "\fBConnectionInbound"
323 Connections made to the \fBsmtpd\fR server.
324 .IP "\fBConnectionLostInbound"
325 Connections lost to the \fBsmtpd\fR server.
326 .IP "\fBConnectionLostOutbound"
327 Connections lost during \fBsmtp\fR communications with remote MTA.
328 .IP "\fBConnectToFailure"
329 Failures reported by \fBsmtp\fR when connecting to remote MTA.
330 .IP "\fBDatabaseGeneration"
331 Warnings noted when binary database map file requires \fBpostmap\fR update from newer source file.
332 .IP "\fBDeferrals"
333 .IP "\fBDeferred"
334 Message delivery deferrals.
335 A single \fBdeferred\fR message will have one or more \fBdeferrals\fR many times.
336 .IP "\fBDeliverable"
337 Address verification indicates recipient address is deliverable.
338 .IP "\fBDelivered"
339 Number of messages handed-off to a delivery agent such as local or virtual.
340 .IP "\fBDiscarded"
341 Messages that triggered access, header_checks or body_checks DISCARD action.
342 .IP "\fBDNSError"
343 Any one of several errors encounted during DNS lookups.
344 .IP "\fBEnvelopeSenderDomains"
345 List of sending domains. (2 levels: envelope sender domain, localpart)
346 .IP "\fBEnvelopeSenders"
347 List of envelope senders. (1 level: envelope sender)
348 .IP "\fBError"
349 Postfix general \fBerror\fR messages.
350 .IP "\fBFatalConfigError"
351 Fatal main.cf or master.cf configuration errors.
352 .IP "\fBFatalError"
353 Postfix general \fBfatal\fR messages.
354 .IP "\fBFiltered"
355 Messages that triggered access, header_checks or body_checks FILTER action.
356 .IP "\fBForwarded"
357 Messages forwarded by MDA for one address class to another (eg. local -> virtual).
358 .IP "\fBHeloError"
359 XXXXXXXXXXX
360 .IP "\fBHold"
361 Messages that were placed on hold by postsuper, or triggered by access, header_checks or body_checks HOLD action.
362 .IP "\fBHostnameValidationError"
363 Invalid hostname detected.
364 .IP "\fBHostnameVerification"
365 Lookup of hostname does not map back to the IP of the peer (ie. the remote system connecting to \fBsmtpd\fR).
366 Also known as forward-confirmed reverse DNS (FCRDNS).
367 When the reverse name has no DNS entry, the message "host not found, try again" is included; otherwise, it is not
368 (e.g. when the reverse has some IP address, but not the one Postfix expects).
369 .IP "\fBIllegalAddrSyntax"
370 Illegal syntax in an email address provided during the MAIL FROM or RCPT TO dialog.
371 .IP "\fBLdapError"
372 Any LDAP errors during LDAP lookup.
373 .IP "\fBMailerLoop"
374 An MX lookup for the best mailer to use to deliver mail would result in a sending to ourselves.
375 .IP "\fBMapProblem"
376 Problem with an access table map that needs correcting.
377 .IP "\fBMessageWriteError"
378 Postfix encountered an error when trying to create a message file somewhere in the spool directory.
379 .IP "\fBNumericHostname"
380 A hostname was found that was numeric, instead of alphabetic.
381 .IP "\fBPanicError"
382 Postfix general \fBpanic\fR messages.
383 .IP "\fBPixWorkaround"
384 Workarounds were enabled to avoid remote Cisco PIX SMTP "fixups".
385 .IP "\fBPolicydWeight"
386 Summarization of policyweight/policydweight results.
387 .IP "\fBPolicySpf"
388 Summarization of PolicySPF results.
389 .IP "\fBPostgrey"
390 Summarization of Postgrey results.
391 .IP "\fBPostscreen"
392 Summarization of 2.7's postscreen and verify services.
393 .IP "\fBDNSBLog"
394 Summarization of 2.7's dnsblog service.
395 .IP "\fBPrepended"
396 Messages that triggered header_checks or body_checks PREPEND action.
397 .IP "\fBProcessExit"
398 Postfix services that exited unexpectedly.
399 .IP "\fBProcessLimit"
400 A Postfix service has reached or exceeded the maximum number of processes allowed.
401 .IP "\fBQueueWriteError"
402 Problems writing a Postfix queue file.
403 .IP "\fBRblError"
404 Lookup errors for RBLs.
405 .IP "\fBRedirected"
406 Messages that triggered access, header_checks or body_checks REDIRECT action.
407 .IP "\fB###RejectBody"
408 Messages that triggered body_checks REJECT action.
409 .IP "\fB###RejectClient"
410 Messages rejected by client access controls (smtpd_client_restrictions).
411 .IP "\fB###RejectConfigError"
412 Message rejected due to server configuration errors.
413 .IP "\fB###RejectContent"
414 Messages rejected by message_reject_characters.
415 .IP "\fB###RejectData"
416 Messages rejected at DATA stage in SMTP conversation (smtpd_data_restrictions).
417 .IP "\fB###RejectEtrn"
418 Messages rejected at ETRN stage in SMTP conversation (smtpd_etrn_restrictions).
419 .IP "\fB###RejectHeader"
420 Messages that triggered header_checks REJECT action.
421 .IP "\fB###RejectHelo"
422 Messages rejected at HELO/EHLO stage in SMTP conversation (smtpd_helo_restrictions).
423 .IP "\fB###RejectInsufficientSpace"
424 Messages rejected due to insufficient storage space.
425 .IP "\fB###RejectLookupFailure"
426 Messages rejected due to temporary DNS lookup failures.
427 .IP "\fB###RejectMilter"
428 Milter rejects. No reject reply code is available for these rejects, but an extended 5.7.1 DSN is provided.
429 These rejects are forced into the generic 5xx rejects group.
430 If you redefine \fBreject_reply_patterns\fR such that it does not contain the pattern \fB5..\fR, milter rejects
431 will not be output.
432 .IP "\fB###RejectRbl"
433 Messages rejected by an RBL hit.
434 .IP "\fB###RejectRecip"
435 Messages rejected by recipient access controls (smtpd_recipient_restrictions).
436 .IP "\fB###RejectRelay"
437 Messages rejected by relay access controls.
438 .IP "\fB###RejectSender"
439 Messages rejected by sender access controls (smtpd_sender_restrictions).
440 .IP "\fB###RejectSize"
441 Messages rejected due to excessive message size.
442 .IP "\fB###RejectUnknownClient"
443 Messages rejected by unknown client access controls.
444 .IP "\fB###RejectUnknownReverseClient"
445 Messages rejected by unknown reverse client access controls.
446 .IP "\fB###RejectUnknownUser"
447 Messages rejected by unknown user access controls.
448 .IP "\fB###RejectUnverifiedClient"
449 Messages rejected by unverified client access controls.
450 .IP "\fB###RejectVerify"
451 Messages rejected dueo to address verification failures.
452 .IP "\fBReplaced"
453 Messages that triggered header_checks or body_checks REPLACE action.
454 .IP "\fBReturnedToSender"
455 Messages returned to sender due to exceeding queue lifetime (maximal_queue_lifetime).
456 .IP "\fBSaslAuth"
457 SASL authentication successes, includes SASL method, username, and sender when present.
458 .IP "\fBSaslAuthFail"
459 SASL authentication failures.
460 .IP "\fBSent"
461 Messages sent via the SMTP delivery agent.
462 .IP "\fBSentLmtp"
463 Messages sent via the LMTP delivery agent.
464 .IP "\fBSmtpConversationError"
465 Errors during the SMTP/ESMTP dialog.
466 .IP "\fBSmtpProtocolViolation"
467 Protocol violation during the SMTP/ESMTP dialog.
468 .IP "\fBStartupError"
469 Errors during Postfix server startup.
470 .IP "\fBTimeoutInbound"
471 Connections to \fBsmtpd\fR that timed out.
472 .IP "\fBTlsClientConnect"
473 TLS client connections.
474 .IP "\fBTlsOffered"
475 TLS communication offerred.
476 .IP "\fBTlsServerConnect"
477 TLS server connections.
478 .IP "\fBTlsUnverified"
479 Unverified TLS connections.
480 .IP "\fBUndeliverable"
481 Address verification indicates recipient address is undeliverable.
482 .IP "\fBWarn"
483 Messages that triggered access, header_checks or body_checks WARN action.
484 .IP "\fBWarnConfigError"
485 Warnings regarding Postfix configuration errors.
486 .IP "\fBWarningsOther"
487 Postfix general \fBwarning\fR messages.
488
489 .PD
490 .SH LEVEL CONTROL
491 .ad
492 .fi
493 The \fBDetailed\fR section of the report consists of a number of sub-sections,
494 each of which is controlled both globally and independently.
495 Two settings influence the output provided in the \fBDetailed\fR report:
496 a global detail level (specified with \fB--detail\fR) which has final (big hammer)
497 output-limiting control over the \fBDetailed\fR section,
498 and sub-section specific detail settings (small hammer), which allow further limiting
499 of the output for a sub-section.
500 Each sub-section may be limited to a specific depth level, and each sub-level may be limited with top N or threshold limits.
501 The \fIlevelspec\fR argument to each of the level limiters listed above is used to accomplish this.
502
503 It is probably best to continue explanation of sub-level limiting with the following well-known outline-style hierarchy, and
504 some basic examples:
505 .nf
506
507 level 0
508 level 1
509 level 2
510 level 3
511 level 4
512 level 4
513 level 2
514 level 3
515 level 4
516 level 4
517 level 4
518 level 3
519 level 4
520 level 3
521 level 1
522 level 2
523 level 3
524 level 4
525 .fi
526 .PP
527 The simplest form of output limiting suppresses all output below a specified level.
528 For example, a \fIlevelspec\fR set to "2" shows only data in levels 0 through 2.
529 Think of this as collapsing each sub-level 2 item, thus hiding all inferior levels (3, 4, ...),
530 to yield:
531 .nf
532
533 level 0
534 level 1
535 level 2
536 level 2
537 level 1
538 level 2
539 .fi
540 .PP
541 Sometimes the volume of output in a section is too great, and it is useful to suppress any data that does not exceed a certain threshold value.
542 Consider a dictionary spam attack, which produces very lengthy lists of hit-once recipient email or IP addresses.
543 Each sub-level in the hierarchy can be threshold-limited by setting the \fIlevelspec\fR appropriately.
544 Setting \fIlevelspec\fR to the value "2::5" will suppress any data at level 2 that does not exceed a hit count of 5.
545 .PP
546 Perhaps producing a top N list, such as top 10 senders, is desired.
547 A \fIlevelspec\fR of "3:10:" limits level 3 data to only the top 10 hits.
548 .PP
549 With those simple examples out of the way, a \fIlevelspec\fR is defined as a whitespace- or comma-separated list of one or more of the following:
550 .IP "\fIl\fR"
551 Specifies the maximum level to be output for this sub-section, with a range from 0 to 10.
552 if \fIl\fR is 0, no levels will be output, effectively disabling the sub-section
553 (level 0 data is already provided in the Summary report, so level 1 is considered the first useful level in the \fBDetailed\fR report).
554 Higher values will produce output up to and including the specified level.
555 .IP "\fIl\fB.\fIn\fR"
556 Same as above, with the addition that \fIn\fR limits this section's level 1 output to
557 the top \fIn\fR items.
558 The value for \fIn\fR can be any integer greater than 1.
559 (This form of limiting has less utility than the syntax shown below. It is provided for
560 backwards compatibility; users are encouraged to use the syntax below).
561 .IP "\fIl\fB:\fIn\fB:\fIt\fR"
562 This triplet specifies level \fIl\fR, top \fIn\fR, and minimum threshold \fIt\fR.
563 Each of the values are integers, with \fIl\fR being the level limiter as described above, \fIn\fR being
564 a top \fIn\fR limiter for the level \fIl\fR, and \fIt\fR being the threshold limiter for level \fIl\fR.
565 When both \fIn\fR and \fIt\fR are specified, \fIn\fR has priority, allowing top \fIn\fR lists (regardless of
566 threshold value).
567 If the value of \fIl\fR is omitted, the specified values for \fIn\fR and/or \fIt\fR are used for
568 all levels available in the sub-section.
569 This permits a simple form of wildcarding (eg. place minimum threshold limits on all levels).
570 However, specific limiters always override wildcard limiters.
571 The first form of level limiter may be included in \fIlevelspec\fR to restrict output, regardless of how many triplets are present.
572 .PP
573 All three forms of limiters are effective only when \fBpostfix-logwatch\fR's detail level is 5
574 or greater (the \fBDetailed\fR section is not activated until detail is at least 5).
575 .PP
576 See the \fBEXAMPLES\fR section for usage scenarios.
577 .SH CONFIGURATION FILE
578 .ad
579 \fBPostfix-logwatch\fR can read configuration settings from a configuration file.
580 Essentially, any command line option can be placed into a configuration file, and
581 these settings are read upon startup.
582
583 Because \fBpostfix-logwatch\fR can run either standalone or within Logwatch,
584 to minimize confusion, \fBpostfix-logwatch\fR inherits Logwatch's configuration
585 file syntax requirements and conventions.
586 These are:
587 .IP \(bu 4'.
588 White space lines are ignored.
589 .IP \(bu 4'.
590 Lines beginning with \fB#\fR are ignored
591 .IP \(bu 4'.
592 Settings are of the form:
593 .nf
594
595 \fIoption\fB = \fIvalue\fR
596
597 .fi
598 .IP \(bu 4'.
599 Spaces or tabs on either side of the \fB=\fR character are ignored.
600 .IP \(bu 4'.
601 Any \fIvalue\fR protected in double quotes will be case-preserved.
602 .IP \(bu 4'.
603 All other content is reduced to lowercase (non-preserving, case insensitive).
604 .IP \(bu 4'.
605 All \fBpostfix-logwatch\fR configuration settings must be prefixed with "\fB$postfix_\fR" or
606 \fBpostfix-logwatch\fR will ignore them.
607 .IP \(bu 4'.
608 When running under Logwatch, any values not prefixed with "\fB$postfix_\fR" are
609 consumed by Logwatch; it only passes to \fBpostfix-logwatch\fR (via environment variable)
610 settings it considers valid.
611 .IP \(bu 4'.
612 The values \fBTrue\fR and \fBYes\fR are converted to 1, and \fBFalse\fR and \fBNo\fR are converted to 0.
613 .IP \(bu 4'.
614 Order of settings is not preserved within a configuration file (since settings are passed
615 by Logwatch via environment variables, which have no defined order).
616 .PP
617 To include a command line option in a configuration file,
618 prefix the command line option name with the word "\fB$postfix_\fR".
619 The following configuration file setting and command line option are equivalent:
620 .nf
621
622 \fB$postfix_Line_Style = Truncate\fR
623
624 \fB--line_style Truncate\fR
625
626 .fi
627 Level limiters are also prefixed with \fB$postfix_\fR, but on the command line are specified with the \fB--limit\fR option:
628 .nf
629
630 \fB$postfix_Sent = 2\fR
631
632 \fB--limit Sent=2\fR
633
634 .fi
635
636
637 The order of command line options and configuration file processing occurs as follows:
638 1) The default configuration file is read if it exists and no \fB--config_file\fR was specified on a command line.
639 2) Configuration files are read and processed in the order found on the command line.
640 3) Command line options override any options already set either via command line or from any configuration file.
641
642 Command line options are interpreted when they are seen on the command line, and later options will override previously set options.
643 The notable exception is with limiter variables, which are interpreted in the order found, but only after all other options have been processed.
644 This allows \fB--reject_reply_patterns\fR to determine the dynamic list of the various reject limiters.
645
646 See also \fB--reject_reply_patterns\fR.
647 .SH "EXIT STATUS"
648 .na
649 .nf
650 .ad
651 .fi
652 The \fBpostfix-logwatch\fR utility exits with a status code of 0, unless an error
653 occurred, in which case a non-zero exit status is returned.
654 .SH "EXAMPLES"
655 .na
656 .nf
657 .ad
658 .fi
659 .SS Running Standalone
660 \fBNote:\fR \fBpostfix-logwatch\fR reads its log data from one or more named Postfix log files, or from STDIN.
661 For brevity, where required, the examples below use the word \fIfile\fR as the command line
662 argument meaning \fI/path/to/postfix.log\fR.
663 Obviously you will need to substitute \fIfile\fR with the appropriate path.
664 .nf
665 .PP
666 To run \fBpostfix-logwatch\fR in standalone mode, simply run:
667 .nf
668 .RS 4
669 .PP
670 \fBpostfix-logwatch \fIfile\fR
671 .RE 0
672 .nf
673 .PP
674 A complete list of options and basic usage is available via:
675 .nf
676 .RS 4
677 .PP
678 \fBpostfix-logwatch --help\fR
679 .RE 0
680 .nf
681 .PP
682 To print a summary only report of Postfix log data:
683 .nf
684 .RS 4
685 .PP
686 \fBpostfix-logwatch --detail 1 \fIfile\fR
687 .RE 0
688 .fi
689 .PP
690 To produce a summary report and a one-level detail report for May 25th:
691 .nf
692 .RS 4
693 .PP
694 \fBgrep 'May 25' \fIfile\fB | postfix-logwatch --detail 5\fR
695 .RE 0
696 .fi
697 .PP
698 To produce only a top 10 list of Sent email domains, the summary report and detailed reports
699 are first disabled.
700 Since commands line options are read and enabled left-to-right,
701 the Sent section is re-enabled to level 1 with a level 1 top 10 limiter:
702 .nf
703 .RS 4
704 .PP
705 \fBpostfix-logwatch --nosummary --nodetail --limit sent='1 1:10:' \fIfile\fR
706 .RE 0
707 .fi
708 .PP
709 The following command and its sample output shows a more complex level limiter example.
710 The command gives the top 3 Sent email addresses from the top 5 domains,
711 in addition, all level 3 items with a hit count of 2 or less are suppressed (in the Sent sub-section,
712 this happens to be email's Original To address).
713 Ellipses indicate top N or threshold-limited data:
714 .nf
715 .RS 4
716 .PP
717 \fBpostfix-logwatch --nosummary --nodetail \\
718 --limit sent '1:5: 2:3: 3::2' \fIfile\fR
719 .nf
720
721 1762 Sent via SMTP -----------------------------------
722 352 example.com
723 310 joe
724 255 joe.bob@virtdomain.example.com
725 7 info@virtdomain.example.com
726 21 pooryoda3
727 11 hot93uh
728 ...
729 244 sample.net
730 97 buzz
731 26 leroyjones
732 14 sally
733 ...
734 152 example.net
735 40 jim_jameson
736 23 sam_sampson
737 19 paul_paulson
738 ...
739 83 sample.us
740 44 root
741 39 jenny1
742 69 dom3.example.us
743 10 kay
744 7 ron
745 6 mrsmith
746 ...
747 ...
748 .fi
749 .RE 0
750 .fi
751 .PP
752 The next command uses both \fBreject_reply_patterns\fR and level limiters to see 421 RBL rejects,
753 threshold-limiting level 2 output to hits greater than 5 (level 2 in the Reject RBL sub-section
754 is the client's IP address / hostname pair).
755 This makes for a very nice RBL offenders list, shown in the sample output
756 (note the use of the unambiguous, abbreviated command line option reject_reply_pat):
757 .nf
758 .RS 4
759 .PP
760 \fBpostfix-logwatch --reject_reply_pat '421 4.. 5.. Warn' \\
761 --nosummary --nodetail --limit 421rejectrbl='2 2::5' \fIfile\fR
762 .nf
763
764 300 421 Reject RBL ---------------------------------------
765 243 zen.spamhaus.org=127.0.0.2
766 106 10.0.0.129 129.0.0.example.com
767 41 192.168.10.70 hostx10.sample.net
768 40 192.168.42.39 hostz42.sample.net
769 15 10.1.1.152 dsl-10-1-1-152.example.us
770 14 10.10.10.122 mail122.sample.com
771 7 192.168.3.44 smalltime-spammer.example.com
772 ...
773 48 zen.spamhaus.org=127.0.0.4
774 17 10.29.124.92 10-29-124-92.adsl-static.sample.us
775 ...
776 8 zen.spamhaus.org=127.0.0.11
777 ...
778 1 zen.spamhaus.org=127.0.0.10
779 ...
780 .fi
781 .RE 4
782 .SS Running within Logwatch
783 \fBNote:\fR Logwatch versions prior to 7.3.6, unless configured otherwise, required the \fB--print\fR option to print to STDOUT instead of sending reports via email.
784 Since version 7.3.6, STDOUT is the default output destination, and the \fB--print\fR option has been replaced
785 by \fB--output stdout\fR. Check your configuration to determine where report output will be directed, and add the appropriate option to the commands below.
786 .PP
787 To print a summary report for today's Postfix log data:
788 .nf
789 .RS 4
790 .PP
791 \fBlogwatch --service postfix --range today --detail 1\fR
792 .RE 0
793 .nf
794 .PP
795 To print a report for today's Postfix log data, with one level
796 of detail in the \fBDetailed\fR section:
797 .nf
798 .RS 4
799 .PP
800 \fBlogwatch --service postfix --range today --detail 5\fR
801 .RE 0
802 .fi
803 .PP
804 To print a report for yesterday, with two levels of detail in the \fBDetailed\fR section:
805 .nf
806 .RS 4
807 .PP
808 \fBlogwatch --service postfix --range yesterday --detail 6\fR
809 .RE 0
810 .fi
811 .PP
812 To print a report from Dec 12th through Dec 14th, with four levels of detail in the \fBDetailed\fR section:
813 .nf
814 .RS 4
815 .PP
816 \fBlogwatch --service postfix --range \\
817 'between 12/12 and 12/14' --detail 8\fR
818 .RE 0
819 .PP
820 To print a report for today, with all levels of detail:
821 .nf
822 .RS 4
823 .PP
824 \fBlogwatch --service postfix --range today --detail 10\fR
825 .RE 0
826 .PP
827 Same as above, but leaves long lines uncut:
828 .nf
829 .RS 4
830 .PP
831 \fBlogwatch --service postfix --range today --detail 11\fR
832 .RE 0
833
834 .SH "ENVIRONMENT"
835 .na
836 .nf
837 .ad
838 .fi
839 The \fBpostfix-logwatch\fR program uses the following (automatically set) environment
840 variables when running under Logwatch:
841 .IP \fBLOGWATCH_DETAIL_LEVEL\fR
842 This is the detail level specified with the Logwatch command line argument \fB--detail\fR
843 or the \fBDetail\fR setting in the ...conf/services/postfix.conf configuration file.
844 .IP \fBLOGWATCH_DEBUG\fR
845 This is the debug level specified with the Logwatch command line argument \fB--debug\fR.
846 .IP \fBpostfix_\fIxxx\fR
847 The Logwatch program passes all settings \fBpostfix_\fIxxx\fR in the configuration file ...conf/services/postfix.conf
848 to the \fBpostfix\fR filter (which is actually named .../scripts/services/postfix) via environment variable.
849 .SH "FILES"
850 .na
851 .nf
852 .SS Standalone mode
853 .IP "/usr/local/bin/postfix-logwatch"
854 The \fBpostfix-logwatch\fR program
855 .IP "/usr/local/etc/postfix-logwatch.conf"
856 The \fBpostfix-logwatch\fR configuration file in standalone mode
857 .SS Logwatch mode
858 .IP "/etc/logwatch/scripts/services/postfix"
859 The Logwatch \fBpostfix\fR filter
860 .IP "/etc/logwatch/conf/services/postfix.conf"
861 The Logwatch \fBpostfix\fR filter configuration file
862 .SH "SEE ALSO"
863 .na
864 .nf
865 logwatch(8), system log analyzer and reporter
866 .SH "README FILES"
867 .na
868 .ad
869 .nf
870 README, an overview of \fBpostfix-logwatch\fR
871 Changes, the version change list history
872 Bugs, a list of the current bugs or other inadequacies
873 Makefile, the rudimentary installer
874 LICENSE, the usage and redistribution licensing terms
875 .SH "LICENSE"
876 .na
877 .nf
878 .ad
879 Covered under the included MIT/X-Consortium License:
880 http://www.opensource.org/licenses/mit-license.php
881 .SH "AUTHOR(S)"
882 .na
883 .nf
884 Mike Cappella
885
886 .fi
887 The original \fBpostfix\fR Logwatch filter was written by
888 Kenneth Porter, and has had many contributors over the years.
889 They are entirely not responsible for any errors, problems or failures since the current author's
890 hands have touched the source code.