Custom log format (clog) is one of the output formatting options. Unlike ASCII and HTML, which are reporting formats, clog is a sort of log file filter. It's main function is to convert the multi-line sendmail log file to a simple, one-line-per-delivery format. This simple log file may then be further analysed with another log analyzer, for example the excellent analog (anyone interested in writing analog configuration for SMA?).
Custom logging is invoked with command line option (-O clog) and/or configured using the following configuration file keywords:
Format | clog |
ClogFormat | FORMATSTRING |
The value FORMATSTRING controls the information and how it is formatted. It 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) |
%% | %-character |
\n | newline |
\t | tab stop |
\\ | single backslash |
ClogFormat "%D: from=%f, to=%t, size=%z"looks at the output side like
Thu Oct 25 04:24:56 2001: from=sender1, to=recipient1, size=10 Thu Oct 25 04:24:57 2001: from=sender2, to=recipient2, size=20 Thu Oct 25 04:24:58 2001: from=sender3, to=recipient3 size=30Unlike ASCII and HTML, Custom logging is done in real-time and it runs with a very small memory footprint. Piping the output of running sendmail daemon might be a very interesting application:
$ tail -f /var/log/maillog | sma -O clogBack to SMA home page Home