[cups] accounting to mysql database?

hw hw at gc-24.de
Tue Jan 17 04:11:03 PST 2017


Alan Corey schrieb:
>> is there a way to have cups write accounting information directly
>> into a mysql database rather than to the page.log?
>
> Such a thing would give preference to Mysql when SQLite and PostgreSQL
> plus a few more are equally valid options.  Better I think to do
> something generic like tab-delimited text which can be easily imported
> into any of them and doesn't require any special libraries.  Please,
> no XML. :)
>

Yes, it doesn´t need to be mysql and could be anything.

If it was possible to give SQL statements to be executed when data is to
be written to the page_log, any SQL database could be used.

However, I´m getting different log entries from different printers and had
to adjust my log-conversion program to deal with all the different formats.

Reading from a named piped has, IIUC, the disadvantage that the program
reading from it must be running and reading the data, for otherwise the
pipe will get full and the program writing to it is halted until the pipe
is emptied.  If that´s true, I wouldn´t like doing this because it makes
for a point of failure.

Starting a program that retrieves the data every time something would be
written to the log comes with all the overhead of starting a program,
which isn´t ideal, either.

XML sucks, and for some variant of CSV, cpus would need to make sure to
correctly escape field delimiters and text-markers.  If it wasn´t for
that, you could have cups write your own CSV variant by specifying the
PageLogFormat to create it.

Still you would need to poll from a CSV file same way you need to poll
the log file, so it won´t be too great of an improvement.

I resorted to having the job-name written as the last field of the line
in the log file, thus avoiding problems with spaces within the job name
making it impossible to use regular expressions to obtain the fields.

This really is a missing feature.




More information about the cups mailing list