Bug 1023650 - CustomLog don't like chained pipes anymore
Summary: CustomLog don't like chained pipes anymore
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: httpd
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-26 14:23 UTC by Peter Bieringer
Modified: 2013-10-28 19:53 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-10-28 08:40:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Peter Bieringer 2013-10-26 14:23:17 UTC
Description of problem:
While Apache 2.0 (CentOS 5) and 2.2 (CentOS 6) have no issues with chained pipes in CustomLog directive, it looks like that 2.4.6 from Fedora 19 won't support this anymore.

Version-Release number of selected component (if applicable):
httpd-2.4.6-2.fc19.i686

How reproducible:
Always

Steps to Reproduce:
1. create additional CustomLog directives with (chained) pipes, e.g.

<IfModule log_config_module>
	# Anonymized log
	CustomLog "|/usr/local/bin/ipv6loganon -f -a /var/log/httpd/access-anon_log" combined

        # Default log with cronolog extension
        CustomLog "|/usr/sbin/cronolog /var/log/httpd/access.log-%Y%m%d" combined

        # Anonymized log with cronolog extension
        CustomLog "|/usr/local/bin/ipv6loganon -f |/usr/sbin/cronolog /var/log/httpd/access-anon.log-%Y%m%d" combined
</IfModule>

2. Start Apache
3. Submit a curl request

Actual results:
# ll /var/log/httpd/access*
-rw-r--r--. 1 root root 81 Oct 26 16:10 /var/log/httpd/access-anon_log
-rw-r--r--. 1 root root 81 Oct 26 16:10 /var/log/httpd/access_log
-rw-r--r--. 1 root root 81 Oct 26 16:10 /var/log/httpd/access.log-20131026


Expected results:
#  ll /var/log/httpd/access*
-rw-r--r-- 1 root root 165 Oct 26 13:51 /var/log/httpd/access-anon_log
-rw-r--r-- 1 root root 165 Oct 26 13:51 /var/log/httpd/access-anon.log-20131026
-rw-r--r-- 1 root root 165 Oct 26 13:51 /var/log/httpd/access_log
-rw-r--r-- 1 root root 165 Oct 26 13:51 /var/log/httpd/access.log-20131026


Additional info:
Running httpd with -X shows, that output from 1st pipe will be printed to stdout somehow instead of further piping into 2nd pipe.

F19:
# httpd -X
::1 - - [26/Oct/2013:16:20:18 +0200] "GET / HTTP/1.1" 403 4609 "-" "curl/7.29.0"

CentOS5/CentOS6 stays quiet


CentOS5:
# ps ax |grep ipv6loganon
13798 ?        S      0:00 /usr/local/bin/ipv6loganon -f -a /var/log/httpd/access-anon_log
13800 ?        S      0:00 /bin/sh -c /usr/local/bin/ipv6loganon -f |/usr/sbin/cronolog /var/log/httpd/access-anon.log-%Y%m%d
13801 ?        S      0:00 /usr/local/bin/ipv6loganon -f
13831 pts/0    S+     0:00 grep ipv6loganon

CentOS6:
# ps ax |grep ipv6loganon
12747 ?        S      0:00 /usr/local/bin/ipv6loganon -f -a /var/log/httpd/access-anon_log
12749 ?        S      0:00 /bin/sh -c /usr/local/bin/ipv6loganon -f |/usr/sbin/cronolog /var/log/httpd/access-anon.log-%Y%m%d
12752 ?        S      0:00 /usr/local/bin/ipv6loganon -f
12783 pts/1    S+     0:00 grep ipv6loganon


FC19:
# ps ax |grep ipv6loganon
 2575 ?        S      0:00 /usr/local/bin/ipv6loganon -f -a /var/log/httpd/access-anon_log
 2577 ?        S      0:00 /usr/local/bin/ipv6loganon -f |/usr/sbin/cronolog /var/log/httpd/access-anon.log-%Y%m%d


BTW: error_log of F19 won't show anything about "don't like chained pipes".

Looks like behavior changed from Apache 2.0/2.2 to 2.4 using pipes in CustomLog.

I assume that many other examples on the Internet with chained pipes in CustomLog won't work anymore.

Final question: is this a new behavior or a bug?

Comment 1 Joe Orton 2013-10-28 08:40:32 UTC
New, slightly annoying behaviour.  With 2.2 and early we always used /bin/sh -c to execute the piped logger.  With 2.4 that has changed, you now have to use:

   CustomLog "|$..."

if you want the command to be passed to sh -c.

See http://httpd.apache.org/docs/2.4/logs.html#piped

Comment 2 Joe Orton 2013-10-28 14:34:03 UTC
I've updated the upstream docs to note this issue: please see below for other things which might catch you out when upgrading from 2.2.

http://httpd.apache.org/docs/2.4/upgrading.html#run-time

Comment 3 Peter Bieringer 2013-10-28 19:39:00 UTC
thank you for the fast update.

BTW: is there any syntax for configuration files available like shown below to avoid serving different config file:

<IfVersion >= 2.4>
CustomLog "|$/usr/local/apache/bin/rotatelogs   /var/log/access_log 86400" common
<ELSE>
CustomLog "|/usr/local/apache/bin/rotatelogs   /var/log/access_log 86400" common
</IfVersion>

Comment 4 Joe Orton 2013-10-28 19:53:57 UTC
Yes, but you'll have to use two separate <IfVersion> sections, there is no <Else>

http://httpd.apache.org/docs/2.2/mod/mod_version.html

... and it relies on you having mod_version loaded in 2.2 (which was the default in recent Fedora but not going back forever).


Note You need to log in before you can comment on or make changes to this bug.