Hi,

last week I was trying to write my own module to log error_log to systemd-journal [1] and I've found out that with the current error_log code, it's not possible to do that properly.

I was able to use "error_log" hook, but there is no way to disable creation of "ErrorLog" file (One can set it to "/dev/null", but httpd will still write data to it without any reason). Syslog logger fixes that by hardcoding syslog methods in log.c/core.c, but I don't think that's the right thing to do with journald.

Therefore, I've created following patches:
http://people.apache.org/~jkaluza/patches/logging/

Their descriptions should be clear from their names, but I will describe them briefly here too.

Patch 0001 declares ap_errorlog_provider which can be implemented by module providing error_log logger. Admin can later define "ErrorLog provider arg" to choose particular errorlog provider. Old syntax still works and the change is backward compatible. This patch also removes syslog logging from log.c (it is moved to newly created mod_syslog.c in next patch)

Patch 0002 creates mod_syslog.c which uses the new API to implement syslog logging. It works the same way as the version in log.c I removed in previous patch, but it's in separate module.

Patch 0003 shows how mod_journald.c can use the existing API. This module works well with systemd-journal, but unfortunately the performance of systemd-journal daemon is poor so far [2], but I presume it will be fixed and the module will be usable for general use in the future. There is probably no real benefit in accepting this last patch right now. It's here to only show why the previous two patches are useful.

Note that this is my first bigger patch touching httpd core, so feel free to correct my possible mistakes... :)

[1] http://0pointer.de/blog/projects/journalctl.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=963620
[patches] http://people.apache.org/~jkaluza/patches/logging/

Regards,
Jan Kaluza

Reply via email to