openldap是一个轻型目录访问协议的自由和开源的实现。习惯上我也称之为数据库,但这个数据库和使用sql标准的数据库是有区别的。openldap经常被用到管理员工信息,用于多应用后台的整合和单点登录。默认openldap的日志功以有是不开启的。而日志功能对于我们分析和查找问题是非常有帮助的。
要开启openldap的日志功能是非常简单的:
1.在slapd.conf中加一行:
loglevel 4095 //后面会讲到这里为什么是4095
2.在/etc/syslog.conf 中加入ldap日志文档:
local4.* /var/log/ldap.log
3.在终端用命令重启syslog服务
# service syslog restart
4.在/var/log/下可以找到一个ldap.log文件
我们通过man slapd.conf会发现上面的4095究竟记录的是那些日志:
number | hex-value | log-name | Logging description |
-1 | 0xFFFF | enable all logging | |
0 | 0x0000 | – | logging inhibited – no logging occurs including critical errors. Not recommended. |
1 | 0x1 | acl | trace function calls |
2 | 0x2 | packets | debug packet handling |
4 | 0x4 | args | heavy trace debugging |
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 |
512 | 0x200 | stats2 | stats log entries sent |
1024 | 0x400 | shell | print communication with shell backends |
2048 | 0x800 | parse | print entry parsing debugging |
4096 | 0x1000 | cache | caching (unused)g |
8192 | 0x2000 | index | indexing (unused) |
16384 | 0x4000 | sync | print syncrepl (replica) logging |
32768 | 0x8000 | none | A misnomer – it will log message that are not categorized including curial messages |
如下所示,如果记录的日志数值不在上面的man查到的表里,就是几个记录及别的和:
loglevel 255 # sets 1, 2, 4, 8, 16, 32, 64 and 128 # adds all the numbers loglevel 2176 # 2048 + 128 loglevel 296 # 256 + 32 + 8
当然,除了用数字表示,我们也可以使用其他表示方法:
# using log-name (single value) loglevel acl # multiple log-name value sloglevel acl sync # combined loglevel 1 0x40 conns
更多的关于openldap的日志配置信息,可以到这里查看:http://www.zytrax.com/books/ldap/ch6/#loglevel
Of course, what a fantastic website and instructive posts, I will bookmark your site.Best Regards!