1832574 Members
3463 Online
110043 Solutions
New Discussion

sudo log to cronolog

 
Ralph Grothe
Honored Contributor

sudo log to cronolog

Hi,

unfortunately, hpux doesn't come with some nifty logrotation mechanism like all Linux distros have with logrotate.
Because I was forced to elevate users' privileges for many tasks I need to run sudo with a couple of rules.
As these are frequently used sudo produces lots of clutter to syslog.log.
So I first prevented it from sending to syslogd by a Defaults !syslog directive and providing an own logfile sudo.log.
However, this still grows relatively quickly,
and I would want to have it rotated automatically.
So I got cronolog which originally was meant as
a substitute for Apache's rotatelog.
The pitfall is, while apache is prepared to log to stdout (viz. to a pipe), visudo complains when I try to write this rule to the sudoers file:

Defaults !syslog, logfile = "|/usr/local/sbin/cronolog /var/adm/syslog/sudo%d.log"

...

"/opt/iexpress/sudo/etc/sudoers.tmp" 47 lines, 1238 characters
visudo: values for `logfile' must start with a '/'
What now?


So it has no notion of pipes, as it seems.
I tried to provide a mkfifo file,
but this won't work since all sudo commands would block until some other process would read from the pipe.
Maybe this could be solved using a unix domain socket?
Has anyone an idea how to reconcile sudo with cronolog?

Madness, thy name is system administration