osixia / docker-openldap

OpenLDAP container image 🐳🌴
MIT License
4.07k stars 978 forks source link

Human-Readable Log Timestamps #251

Open Elewyth opened 6 years ago

Elewyth commented 6 years ago

Currently, this image generates log messages with Hexadecimal timestamps. E.g.

5b572ace conn=2275 op=0 RESULT tag=97 err=0 text=

Where 5b572ace is the Timestamp corresponding to GMT: Tuesday, July 24, 2018 1:34:06 PM according to https://www.epochconverter.com/hex.

Is there any way to configure ldap to generate timestamps in human-readable format?

Thanks in advance!

jamesgoodhouse commented 5 years ago

I'd love to know the answer to this as well, as I recently built a custom LDAP image and am seeing the same thing. I've dug through all the docs and nothing obvious jumps out at me for how to change this.

jamesgoodhouse commented 5 years ago

@Elewyth: Upon further digging through the docs, it appears that OpenLDAP logs to syslog. The hex timestamps is due to the fact that these are debug logs. I don't fully understand why these logs necessarily need to be different, but best I can tell there is no way to fix this.

With that said, the approach we took to fixing this is to run syslog inside our container and to direct those logs to stdout. We opted to use the s6-overlay for docker to allow us to run two processes within our container and to ensure that if syslog dies that it will be restarted.

Postfix suffers from a similar/worse issue in that it can only log to syslog, so I'd recommend looking at some solutions that exist for running it in a container and getting the syslog logs to stdout. If I find time I may try to open a PR for this project, but it may be a bit too much of a heavy change to the code base just to get the logs from syslog.