Re: New logging system ideas

Howard Chu <[email protected]> Wed, 14 Jul 2021 15:40:35 +0100
Newsgroups gmane.network.openldap.devel
Message-ID <[email protected]>
Howard Chu wrote:
> Just some initial thoughts on what a new logging daemon should do for us:

Scaling back to something easier for now:

We'll use the existing Debug msgs as-is. The olcLogFile directive will specify the
path of a local logging file to write to. Currently, writing to this logfile is
controlled by the -d debuglevel flags, not the -s sysloglevel flags. When a logfile
is configured, debug messages go to both stderr and the logfile.

We'll add a new option olcLogFileOnly (boolean), which will force messages to only
go to the logfile (and skip writing any to stderr). Since the point of using the
local file logging facility is for performance, it will be desirable to avoid this
double-writing of messages.

We'll add an olcLogFileRotate option that specifies a logfile maxsize and rotation
interval, in megabytes and hours, respectively. Any message that would cause the
current logfile to exceed the specified size will cause the file to be closed/rotated/reopened.
Any message that arrives after the specified number of hours will do likewise.
Rotated files will be renamed to <logfile>.YYYYMMDDHHMM.

Supporting this rotation functionality will require a mutex around the logger function,
so it's possible that we still won't gain back much performance going down this route.

Possibly the parameter should include another field for max # of logfiles to retain,
I haven't really thought about that yet.

Comments?

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/