[cups] CUPS basic accounting
sawbona at xsmail.com
sawbona at xsmail.com
Fri Mar 20 17:44:15 PDT 2020
Hello:
On 20 Mar 2020 at 19:13, Helge Blischke wrote:
> ... I´d suggest to use a Perl or Python script ...
I have not found simple Perl/Python scripts to do what I need.
With some help from those who know more about awk and such than me, I
have managed to parse the sum of all printed pages from the
/var/log/cups/page_log file by running this awk stanza ...
[code]
awk '/groucho/{pages += $7} END {print pages}' /var/log/cups/page_log
[/code]
... against this log output:
---
Samsung_M2020_Series groucho 100 [21/Dec/2018:08:38:25 -0300] 5 1 -
localhost Leafpad job #1 - -
---
I manually checked the result by tallying all print jobs (!) and the
result was correct.
What I would now like to do is reduce the log file's content as there
being one user and one printer, I really do not need to know which
printer is active or which user is doing the printing.
Nor do I need to log the *full* time, just date and time without the
GMT offset is more than enough.
> ... the page_log entries is highly configurable, I think there are
> very few ...
Quite so.
I have seen a couple of scripts/apps but they seem to be quite
complex, oriented more to network printing, billing, printing caps,
etc.
It seems that I am on the default setting for how the page_log is
formatted and that "The PageLogFormat directive in the cupsd.conf(5)
file can be used to change this information." but I have not found
instructions on how to set it and also read that it has been
deprecated.
[url]
https://manpages.debian.org/experimental/cups-daemon/cupsd.conf.5.en.h
tml
[/url]
Besides that, the page referenced above says that "The default is the
empty string, which disables page logging" but I *am* getting a full
default log but cannot find where it is set.
Any idea as to how I can modify the default to PageLogFormat to get
just the data I want?
Thanks in advance,
G.
More information about the cups
mailing list