2013/02/07

cups-lpd and syslog

cups-lpd logs everything to syslog. This fills up /var/log/messages unnecessarily. I finally pulled out the source code and went about writing a patch so that it logs to a file. And then someone on #cups indirectly pointed out that cups-lpd uses LOG_LPR faculty and syslog can filter with these. The trick is these 2 lines in /etc/syslog.conf
*.info;lpr.!info;mail.none;news.none;authpriv.none;cron.none        /var/log/messages
lpr.*   /var/log/cups/cups-lpd_log
The first one sends *.info, EXCEPT lpr.info to /var/log/messages. The second one sends lpr.* to /var/log/cups/cups-lpd_log. Note that this means that any other program that uses LOG_LPR will also log to the same file.

But that's not all; xinetd also logs to syslog. But it can be easily convinced to log to a file, with the following /etc/xinetd.d/cups-lpd:

service printer
{
    disable = no
    socket_type = stream
    protocol = tcp
    wait = no
    user = lp
    server = /usr/lib/cups/daemon/cups-lpd
    server_args = -o job-sheets=none
    log_type = FILE /var/log/cups/cups-lpd_log
}
So there you have: how to prevent cups-lpd from logging to syslog.

No comments: