Bug 1023650 - CustomLog don't like chained pipes anymore
CustomLog don't like chained pipes anymore
Product: Fedora
Classification: Fedora
Component: httpd (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Joe Orton
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-10-26 10:23 EDT by Peter Bieringer
Modified: 2013-10-28 15:53 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-10-28 04:40:52 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Bieringer 2013-10-26 10:23:17 EDT
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):

How reproducible:

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

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.

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

CentOS5/CentOS6 stays quiet

# 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

# 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

# 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 04:40:32 EDT
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 10:34:03 EDT
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.

Comment 3 Peter Bieringer 2013-10-28 15:39:00 EDT
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
CustomLog "|/usr/local/apache/bin/rotatelogs   /var/log/access_log 86400" common
Comment 4 Joe Orton 2013-10-28 15:53:57 EDT
Yes, but you'll have to use two separate <IfVersion> sections, there is no <Else>


... 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.