On Sat, Apr 28, 2012, at 11:35 AM, John Peach wrote:
> > Since it's Postfix doing the writing to the logs in the 1st place, is it 
> > possible to config Postfix to (free)format those
> 
> It's not postfix - it's syslog.

If you look in Postfix's source code

        ./src/util/msg_syslog.c

                ...
                static int syslog_facility;

                /* msg_syslog_print - log info to syslog daemon */

                static void msg_syslog_print(int level, const char
                *text)
                {
                    static int log_level[] = {
                    LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
                    };
                    static char *severity_name[] = {
                    "info", "warning", "error", "fatal", "panic",
                    };

                    if (level < 0 || level >= (int) (sizeof(log_level) /
                    sizeof(log_level[0])))
                    msg_panic("msg_syslog_print: invalid severity level:
                    %d", level);

                    if (level == MSG_INFO) {
-->                 syslog(syslog_facility | log_level[level], "%.*s",
                           (int) MSG_SYSLOG_RECLEN, text);
                    } else {
-->                 syslog(syslog_facility | log_level[level], "%s:
%.*s",
                           severity_name[level], (int)
                           MSG_SYSLOG_RECLEN, text);
                    }
                }
                ...

that looks to me like Postfix sending pre-assembled string(s) info to
the sys-logger with a format specified.

I can change those strings in Postfix code, recompile, and the output
format that appears in the syslog  changes.

Your comment suggests to me that I can instead change that format "in"
syslog.

If that's the case, can you provide an example of how to use syslog
directly to alter that format?

--
Thanks,
Karen

Reply via email to