[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Logging events to a log file



>> De : Dieter Klünter <dieter@dkluenter.de>
>
>> Am Sat, 22 Sep 2012 19:27:19 +0100 (BST)
>> schrieb Mik J <mikydevel@yahoo.fr>:
>>
>>>  Hello List,
>>>
>>>
>>>  When I start slapd with the option -d 256 I can see what's happening
>>>  when there's a connection # /usr/local/libexec/slapd -4 -d 256 -u
>>>  _openldap -g _openldap -h ldaps:///
>>>
>>>  However I would like to have this in a log file and I added these
>>>  lines to slapd.conf loglevel        256
>>>  logfile         /var/log/slapd.log
>>>  But my log file remains empty after I start the server with (without
>>>  -d 256)
>>>
>>>  # /usr/local/libexec/slapd -4 -u _openldap -g _openldap -h ldaps:///
>>>
>>>  However if I start the server with
>>>  # /usr/local/libexec/slapd -4 -d 256 -u _openldap -g _openldap -h
>>>  ldaps:/// The events display on the screen and in the slapd.log file
>>>  as well. This behavior surprises me, am I missing something ?
>>>
>>>  My ldap server version is 2.4.26p0
>>
>> man slapd(8), read on -d flag, -s flag and -l flag. Furthermore check
>> your syslog configuration, slapd logs to local4 as default.
>>
>> -Dieter
>
>
> Hello,
> Thank you for your answer, I already read the man because asking my
> question but I will read it again.
> My question was about logging the events in a file without using syslog.
> Maybe I misunderstood the documentation and slapd uses syslog only.
> In that case, what's the utility of this directive "logfile        
> /var/log/slapd.log" in slapd.conf ?

Slapd writes messages in two ways; different message types go to separate
locations.  Messages meant for syslog go to syslog; if "-d" is used, they
also go to stderr.  Debug messages are only printed if "-d" is used, and
only go to stderr unless "logfile" is defined.  So "logfile" is a means to
collect debug messages that wouldn't otherwise go to syslog.  Note that
debug loglevel and syslog loglevel are unrelated.  "loglevel" sets the
syslog loglevel (as per slapd.conf(5)), but "logfile" contains debug
loglevel (as per slapd.conf(5), i.e. the value set using "-d").  In some
sense, there is little point in using "loglevel", since it needs "-d"; you
could do

slapd -d stats,trace 2>&1 | tee logfile.txt

p.

-- 
Pierangelo Masarati
Associate Professor
Dipartimento di Ingegneria Aerospaziale
Politecnico di Milano