Remove obsolete *.log-files from openLDAP DB-folder

If you use the openLDAP-server you will probably run into the problem that the *.log-files located in the DB’s folder will comsume more and more free space.
It seems that the automatic maintenance service that should clean up no longer used log-files is somehow broken.
Luckly there is a command that removes any log-files that aren’t needed any more:

db_archive -d -h

In CentOS, the DB files normally reside at /var/lib/ldap, so the resulting line would be:

db_archive -d -h /var/lib/ldap

Of couse, you could also add this as a daily cronjob:

# LDAP DB maintenance
0 3 * * * /usr/bin/db_archive -d -h /var/lib/ldap

4 comments

    1. Thanks for your comment.
      This is true, but unfortunately this feature does not work as expected. From my observations the autoremove is only done once when the service is (re-)started and NOT repeated periodically as one would assume.
      That’s the main reason for my approach using cron.

  1. What if there are ldap replication servers. Do you need to run db_archive on two servers Master and Slave? Is it enough to run on the master server and the rest will replicate?

    1. Hi,
      that’s a good question.
      As the replication service is rather dump and actually simply copies the whole set of files, I would think it’s not needed.

Leave a comment

Your email address will not be published. Required fields are marked *