Bug 54796 - CustomLog should be able to use syslog as ErrorLog does
Summary: CustomLog should be able to use syslog as ErrorLog does
Status: NEEDINFO
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_log_config (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 enhancement with 11 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2013-04-03 13:13 UTC by Petr Sumbera
Modified: 2018-10-03 16:38 UTC (History)
5 users (show)



Attachments
Proposed trivial patch that solves the ticket (12.80 KB, patch)
2013-04-03 19:45 UTC, sscdvp
Details | Diff
Proposed trivial mod_log_config patch against current trunk (9.68 KB, patch)
2013-04-29 08:23 UTC, sscdvp
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Sumbera 2013-04-03 13:13:01 UTC
mod_log_config doesn't allow to use syslog facility like this:

CustomLog syslog:local4

(like it's possible with ErroLog).
Comment 1 sscdvp 2013-04-03 19:45:37 UTC
Created attachment 30145 [details]
Proposed trivial patch that solves the ticket

The patch mimics the same syntax which is used for ErrorLog directive by Apache itself (see server/log.c).
After patch applied Apache log configuration looks like that:
httpd.conf lines:
ErrorLog syslog:local3
CustomLog syslog:local4

syslog.conf lines related to Apache log files:
local4.info /opt/home/data/logs/access.log
local3.info /opt/home/data/logs/error.log

It was tested under Apache 2.2.24
Comment 2 sscdvp 2013-04-05 05:55:39 UTC
Now we can send Apache access logs to remote syslog host (via UDP port 514).

/etc/hosts line related to remote syslog host:
192.168.3.202 apache_virtualhost_logs

syslog.conf lines related to Apache log files:
local4.info @apache_virtualhost_logs
local3.info @apache_virtualhost_logs
Comment 3 Graham Leggett 2013-04-27 18:02:18 UTC
Comment on attachment 30145 [details]
Proposed trivial patch that solves the ticket

Would it be possible to submit this patch as a unified diff (diff -u) against the trunk version of the server?

This looks very useful.
Comment 4 sscdvp 2013-04-29 08:23:47 UTC
Created attachment 30235 [details]
Proposed trivial mod_log_config patch against current trunk

You can find here a patch against trunk version (29-04-2013).
Comment 5 sscdvp 2013-04-29 08:25:38 UTC
Requested unified diff was delivered.
Comment 6 Graham Leggett 2013-04-30 12:15:13 UTC
Comment on attachment 30235 [details]
Proposed trivial mod_log_config patch against current trunk

Unfortunately this patch changes the public API for the ap_log_writer_init() function, which would make it impossible to backport this to httpd v2.4.

Is there a way to handle the syslog mask without passing it in externally? In theory, the syslog mask should map to the LogLevel in some fashion, otherwise httpd would be wasting cycles generating log lines, only for syslog to ignore them.
Comment 7 Ben RUBSON 2016-12-28 10:28:19 UTC
Hi,
Any news regarding this useful feature ?
Many thanks !
Ben
Comment 8 Pat Riehecky 2018-10-03 16:38:23 UTC
Just checking in on this.