OpenLDAP v2.4 enable logging

I have openldap v 2.4 running on centos7 and working but i cannot get it to log anything.
I have tried adding the below line to the rsyslog.conf file but i still do not get any log file.

LOCAL4.*        /var/log/openldap/slapd.log

When i added this line i ran the below command to reload the rsyslog conf and also stopped and started openldap.

pkill -HUP rsyslog

I cant find any more instruction on how to enable logging.

Asked By: a.smith


To enable OpenLDAP debugs, you would want to add the following to your slapd.conf

loglevel <level> (eg: stats)

If you do not use slapd.conf, you may then pass that option to the slapd service. In debian/ubuntu, you would find some /etc/default/slapd file, you may update its SLAPD_OPTIONS:

$ grep SLAPD_OPTIONS /etc/default/slapd

We may then restart slapd:

systemctl restart slapd

Valid slapd log levels would include:

| -1          | Enable all debugging                          |
|  0          | Enable no debugging                           |
|  1          | Trace function calls                          |
|  2          | Debug packet handling                         |
|  4          | Heavy trace debugging                         |
|  8          | Connection management                         |
|  16         | Log packets sent and recieved                 |
|  32         | Search filter processing                      |
|  64         | Configuration file processing                 |
|  128        | Access control list processing                |
|  256        | Stats log connections, operations and results |
|  512        | Stats log entries sent                        |
|  1024       | Log communication with shell backends         |
|  2048       | Log entry parsing debugging                   |

For further details, see

Besides, as Jeff pointed it out, your syslog configuration looks wrong to begin with.

LOCAL4.*        /var/log/openldap/

Should probably be:

LOCAL4.*        /var/log/openldap/some-file.log


LOCAL4.*        /var/log/openldap.log
Answered By: SYN
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.