Printing Audit

Paul paul.conklin at cerner.com
Fri May 27 07:43:20 PDT 2011


Well, there are a variety of ways to get that information.  Most of which will come from the error_log and page_log

You can change what is in the page_log with the PageLogFormat directive (http://www.cups.org/documentation.php/doc-1.5/ref-cupsd-conf.html#PageLogFormat)

If you set the PreserveJobHistory Directive it will keep old jobs (you'll want to manually purge those at some point)

The error_log is really more a system log and it has the last of the information.

Just to start you off, here is a ksh script i use to show counts of jobs sent to each printer.

for PRINTER in `lpstat -a | cut -f1 -d' '`
	do
	((pagecnt=0))
	for line in `grep -c $PRINTER /var/log/cups/page* | cut -f2 -d:`
		do
		((pagecnt=$pagecnt+$line))
	done
	echo "$pagecnt : $PRINTER"
done

Here is another I use to reprint jobs from a backed up spool directory if I need to.
#!/usr/bin/ksh
SPOOLDIR="/bkup/spool/cups/"

DATAFILES=$SPOOLDIR"d*"
STRIPFORMAT=$SPOOLDIR"d"
for line in `ls $DATAFILES | tr -d $STRIPFORMAT | sort`
	do
	JOBNO=`echo $line | cut -f1 -d-`
	PNAME=`grep $JOBNO /var/log/cups/error_log* | grep Queued | tr -d [:punct:] | cut -f8 -d' '`
	echo "lp -d$PNAME $line"
done

Hope that helps.

> Hi everyone,
>
> We are using CUPS and Samba for the share printer. We want to audit the printing usage, we want to know the time, user, IP, the printing document name, also want to get the content of the printing document.
>
> Is there any way or solution for such Printing Audit?
>
> Thanks!
>
> Jian





More information about the cups mailing list