• Contact Us
  • Home

Symas OpenLDAP 2.6 Logging

Discover how to configure and optimize logging in Symas OpenLDAP 2.6 for enhanced performance and troubleshooting capabilities.

Written by Maryanne Normann

Updated at January 20th, 2025

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

Setting Options Implementing Logging SELinux Recommendation

Setting Options

olcLogFile: <filename>
Specify  a file for recording slapd debug messages. These messages are unrelated to messages exposed by the olcLogLevel configuration parameter. This setting only affects the slapd daemon and has no effect on the command line tools. By default these messages only go to stderr and are not recorded anywhere else.  Specifying a logfile copies messages to both stderr and the logfile.

olcLogFileFormat: debug | syslog-utc | syslog-localtime
Specify the prefix format for messages written to the logfile. The debug format is the normal format used for slapd debug messages, with a timestamp in hexadecimal, followed by a thread ID.  The other options are to use  sys‐log(3) style prefixes, with timestamps either in UTC or in the local timezone. The default is debug format.

olcLogFileOnly: TRUE | FALSE
Specify that debug messages should only go to the configured logfile, and not to stderr.

olcLogFileRotate: <max> <Mbytes> <hours>
Specify  automatic  rotation  for  the configured logfile as the maximum number of old logfiles to retain, a maximum size in megabytes to allow a logfile to grow before rotation, and a maximum age in hours for a logfile to be used before rotation. The maximum number must be in the range 1-99.  Setting Mbytes or hours to zero disables the size or age check, respectively.  At least one of Mbytes or hours must be non-zero. By default no automatic rotation will be performed.

olcLogLevel: <integer> [...]
Specify  the  level at which debugging statements and operation statistics should be syslogged (currently logged to the syslogd(8) LOG_LOCAL4 facility.) They must be considered subsystems rather than     increasingly verbose log levels.  Some messages with higher priority are logged regardless of the configured loglevel as soon as any logging is configured.  Log levels are additive, and available levels are:

Level Description
1 (0x1 trace) trace function calls
2 (0x2 packets) debug packet handling
4 (0x4 args) heavy trace debugging (function args)
8 (0x8 conns) connection management
16 (0x10 BER) print out packets sent and received
32 (0x20 filter) search filter processing
64 (0x40 config) configuration file processing
128 (0x80 ACL) access control list processing
256 (0x100 stats) stats log connections/operations/results (default)
512 (0x200 stats2) stats log entries sent
1024 (0x400 shell) print communication with shell backends
2048 (0x800 parse) entry parsing debugging
4096 (0x1000 cache) caching (unused)
8192 (0x2000 index) indexing (unused)
16384 (0x4000 sync) print syncrepl (replica) logging
32768 (0x8000 none) A misnomer - it will log messages that are not categorized - specifically including critical messages

Implementing Logging

Create an LDIF for the logging option:

vi /tmp/logging.ldif
dn: cn=config
changetype: modify
add: olcLogFile
olcLogFile: /var/log/slapd.log       #(or the location of you choosing)
-
add: olcLogFileOnly
olcLogFileOnly: TRUE
-
add: olcLogFileFormat
olcLogFileFormat: syslog-utc         #(if your logs are in local time, use syslog-localtime)
-
add: olcLogFileRotate
olcLogFileRotate: 99 1000 24         #99 old logfiles will be retain, 1000 MBs of data will be allowd until a rotation, 24 hours will elapse for a rotation
-
add: olcLogLevel
olcLogLevel: sync stats
-

Add the logging options:

​ldapmodify -H ldap:/// -D cn=config -W -f logging.ldif

SELinux Recommendation

If running as a non-root user, maintainers need to create a new folder under /var/log to accommodate the logs.  

For example, "/var/log/openldap/slapd.log"

Make the appropriate changes to the ldif:

​olcLogFile:  /var/log/openldap/slapd.log

Also update the directory permissions to chown to slapd user:

​chown openldap:openldap /var/log/openldap

This works for both Debian and RHEL packages, but Debian users can store the file anywhere on the machine (assuming it has file permissions), where RHEL users must store under /var/log, unless changes are made to the SELinux policy.

Copyright © 2020-2024 Symas Corporation. All rights reserved.
configuration update dynamic logging

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to Create Certificates for OpenLDAP
  • OpenLDAP 2.5 Quick Start
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2023, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand