OpenLDAP Quick Tips: Change loglevels on the fly!



Here's the 15th tip in the "OpenLDAP Quick Tips" series:
"You want to change your OpenLDAP loglevel to get more information, but can't take your directory server offline":
If you've been following the OpenLDAP Quick Tips series, you would have already read Switch to the dynamic config backend (cn=config) and will now have a live slapd dynamic backend configured. If not, go back and read it over

Let's say you are running the stats (256) loglevel, but you want to know look at the sync loglevel or both. Making the change is much the same as with Check your indices. First we check our current level:
CODE:
[ghenry@suretec ~]$ ldapsearch -x -H ldap[?]://xxx.xxx.xxx.xxx -b 'cn=config' -D 'cn=config' -s base -LLL -W olcLoglevel
Enter LDAP[?] Password:
dn: cn=config
olcLogLevel: Stats
This shows that we are on the stats (256) level. We can either swap this to sync or add it to the current level not loosing the stats level. Let's add it with the following LDIF:
CODE:
dn: cn=config
changetype: modify
add: olcLoglevel
olcLoglevel: Sync
The results will look like:
CODE:
ldapmodify -x -D 'cn=config' -W -f newloglevel.ldif
which will show in your logs as:
CODE:
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 fd=46 ACCEPT from IP=XXX.XXX.XXX.XXX:46272 (IP=0.0.0.0:389)
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=0 BIND dn="cn=config" method=128
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=0 BIND dn="cn=config" mech=SIMPLE ssf=0
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=0 RESULT tag=97 err=0 text=
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=1 MOD dn="cn=config"
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=1 MOD attr=olcLoglevel
Dec 2 13:06:23 suretecsystems slapd[27824]: slap_queue_csn: queing 0x8b986aa2 20081202130623.645866Z&000000;000#000000
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=1 RESULT tag=103 err=0 text=
Dec 2 13:06:23 suretecsystems slapd[27824]: slap_graduate_commit_csn: removing 0xa39d730 20081202130623.645866Z&000000;000#000000
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 op=2 UNBIND
Dec 2 13:06:23 suretecsystems slapd[27824]: conn=13687 fd=46 close
To remove it just use a delete changetype.
It should now be obvious how to add and change settings via cn=config.
Thanks,
Gavin.
If you have an entry for our "OpenLDAP Quick Tips" series, why not e-mail your tip to us.
P.S. For direct access to this section, you can click OpenLDAP Quick Tips.
Comments
Display comments as Linear | Threaded