CentOS 6 – Enable logging for OpenLDAP

[root@cmlin02 openldap]# vi /etc/rsyslog.conf 

...
# LDAP
local4.* /var/log/ldap.log

 ...
[root@cmlin02 openldap]# /etc/init.d/rsyslog restart
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
[root@cmlin02 openldap]# 
[root@cmlin02 openldap]# touch /var/log/ldap.log
[root@cmlin02 openldap]# service slapd restart
[root@cmlin02 log]# tail -100f /var/log/ldap.log 
...

Jul 25 10:43:24 cmlin02 slapd[10271]: conn=1019 op=196 SRCH attr=cn
Jul 25 10:43:24 cmlin02 slapd[10271]: <= bdb_equality_candidates: (member) not indexed
Jul 25 10:43:24 cmlin02 slapd[10271]: <= bdb_equality_candidates: (uniqueMember) not indexed
Jul 25 10:43:24 cmlin02 slapd[10271]: conn=1019 op=196 SEARCH RESULT tag=101 err=0 nentries=1 text=

Purge OpenLDAP & reimport

 

PURGE LDAP & REIMPORT

1) Export existing ldap

[root@lin02 ldap]# ldapsearch -x -b dc=domain,dc=com > /tmp/ldap_backup_20120621.ldif
…

2) Edit your export to look as you wish.
3) Remove existing db

[root@lin02 ldap]# service slapd stop
Stopping slapd: [ OK ]
[root@lin02 ldap]# rm -fr /var/lib/ldap/*

4) Import file

[root@lin02 ldap]# service ldap start
[root@lin02 ldap]# ldapadd -x -W -D cn=root,dc=domain,dc=com -f /tmp/ldap_new_20120621.ldif
Enter LDAP Password:
adding new entry "dc=domain,dc=com"