18.3. Accounting File

The Accounting File (:af=) option value specifies the destination of accounting information. If the format of the :af option is :as=| ... , then the value is assumed to be a program to be run to record start and end of job information. The program is run in the same manner as a print filter. The values of the :as and :ae options are written to the program's STDIN and the output from the program's STDOUT is used as described below for authorization.

If the :af= option has the format host%port then a TCP/IP connection is opened to the specified port on the indicated host. The values of the :as and :ae options are written to the remote host. The port that the connection originates from will be in the range set by the configuration or printcap originate_port option.

Finally, if the :af= has neither of these formats then it will be treated as a pathname to a file. If the file exists or the create_files option is true, then the file will be opened and the values of the :as and :ae options are written to the file. The accounting file should be periodically truncated.

By convention the :af= value is passed to filters as a command line option. LPRng will pass the option value only if it is specifies a file or network destination. This implies that accounting information can be written to the accounting file or network destinations by the print spooler, :of filters, or print file filters. The filters are responsible for opening the accounting file or network connection.

The following is an example of information written to the accounting file:

jobstart '-Hh4.private' '-nroot' '-Pps' '-kcfA938h4.private' \
'-b1093' '-tNov  5 19:39:25'
start '-p12942' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-c0' '-Fo' '-tSun Nov  5 19:39:25 1995'
filestart '-p12944' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-c0' '-Ff' '-tSun Nov  5 19:39:27 1995'
fileend '-p12944' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-b3' '-c0' '-Ff' '-tSun Nov  5 19:39:58 1995'
end '-p12942' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-b2' '-c0' '-Fo' '-tSun Nov  5 19:39:59 1995'
jobend '-Hh4.private' '-nroot' '-Pps' '-kcfA938h4.private' \
'-b1093' '-tNov  5 19:39:59'

The jobstart and jobend lines are written by lpd and are the expanded :as and :ae values. The start and end line are added by the :of filter. This filter usually queries the printer and gets printer dependent accounting information such as the pagecounter value. The :of filter is then suspended and the job is processed by the various format dependent filters. The the filestart and fileend lines are produced by the other filters.

The max_accounting_file_size and min_accounting_file_size are used by LPRng to control the accounting file size. When the accounting file size exceeds the max_accounting_file_size (in Kbytes), it is truncated to min_accounting_file_size (in Kbytes). If max_accounting_file_size is 0 (zero), then the file is allowed to grow without limit.