On 25. jan. 2016 14:36, Dario Zanzico wrote:
Writing a script for parsing openldap logs I found that, for some of my connections, the BIND log entry precedes the corresponding ACCEPT entry (which as far as i understand must logically precede the BIND) (...) Is there any way to guarantee openldap to generate ordered logs?
Maybe it would work to move Statslog( ... ACCEPT ...) above ldap_pvt_thread_mutex_unlock( &c->c_mutex ); at the end of servers/slapd/connection.c:connection_init(). Holding on to the mutex longer would make slapd a bit less responsive, though. No idea how much.
Another variant: Put the cost in the log parser instead. When you see an ACCEPT, delay processing log lines until you've seen some more lines, in case they are out of order. I've got an old tweak to contrib/slapd-tools/statslog which does that and some other stuff, here: http://folk.uio.no/hbf/OpenLDAP/statslog.reorder
Don't remember why I haven't committed it. Maybe it isn't quite finished or I hoped to optimize it, since it does slow the script down. I'd be glad to hear of any improvements from you:-)
Come to think of it, statslog is quite old. It might need some tweaks to catch up with whatever has been done to OpenLDAP logs since it was written.