You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Michael Michalowski <mi...@interred.de> on 2004/03/03 18:01:17 UTC

[users@httpd] difference of piped logs in Apache 1.3x and 2.x

hi folks,

I have a question concerning the piped log mechanism of Apache. It
makes it possible to treat a proram like a logfile and pipe the
Apache log stream to it. This feature is also available in Apache 2.0,
but I noticed a changed behaviour. Maybe I used an "undocumented
feature" in Apache 1.3x, but I like to ask whether I can emulate the
old behaviour with Apache 2 or not.

So, here is an example which worked in Apache 1.3x:

CustomLog "| program1 | program2" format

It gives the logstream to the first program "program1" and this
programm pipes it's output to the second program "program2". This
definitely worked in Apache 1.3x, but an Apache 2 makes '| program2'
to a simple parameter list of program1 (no more shell interpolation).

Another example would be something like that:

CustomLog "| program1 > /tmp/logfile 2> /tmp/errfile" format

In Apache 1.3x this would log to program1 and print it's output to
logfiles in the /tmp directory (shell interpolated). But for Apache 2.x
the '> /tmp/logfile 2> /tmp/errfile'-part is just a parameter string
for program1.

So, I think the piped log mechanism is a rewrite in Apache 2 and there
might be security issues, that prevent the old behaviour.
Or is it possible to have the old Apache 1.3x behaviour in an Apache2?
If so, please tell me how =)

best regards,
Michael Michalowski



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] difference of piped logs in Apache 1.3x and 2.x

Posted by Joshua Slive <jo...@slive.ca>.

Michael Michalowski wrote:
> JS> Yes, I have seen other similar reports about not having a full shell on 
> JS> the piped loggers in apache 2.  I have some recollection of this being 
> JS> fixed at some point, but I'm not sure.
> 
> Any idea, where I can find these reports? I searched the inet before I
> postet to this mailinglist and found nothing. I also scanned the
> apache changes-file for fixes, but nothing found.

Sorry.  I looked around a little in the bug database, but couldn't find 
a reference.

> 
> JS> In any case, you can always create a small shell script that simply does
> JS> #!/bin/sh
> JS> program1 | program2
> 
> JS> and call that shell script as your piped logger.
> 
> yes, I thought about this solution too, but it's not the same. If I
> use a shell skript, I have to read the STDIN and start the pipe
> process for each log line. This is not the same behaviour, as piping
> the whole log stream.

I don't believe that is true.  Apache should pipe log lines through the 
shell script just as it does for any other piped log program.

You might even be able to get away with
CustomLog "/bin/sh program1 | program2" ...

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re[2]: [users@httpd] difference of piped logs in Apache 1.3x and 2.x

Posted by Michael Michalowski <mi...@interred.de>.
JS> Michael Michalowski wrote:
>> So, here is an example which worked in Apache 1.3x:
>> 
>> CustomLog "| program1 | program2" format
>> 
>> It gives the logstream to the first program "program1" and this
>> programm pipes it's output to the second program "program2". This
>> definitely worked in Apache 1.3x, but an Apache 2 makes '| program2'
>> to a simple parameter list of program1 (no more shell interpolation).

JS> Yes, I have seen other similar reports about not having a full shell on 
JS> the piped loggers in apache 2.  I have some recollection of this being 
JS> fixed at some point, but I'm not sure.

Any idea, where I can find these reports? I searched the inet before I
postet to this mailinglist and found nothing. I also scanned the
apache changes-file for fixes, but nothing found.

JS> In any case, you can always create a small shell script that simply does
JS> #!/bin/sh
JS> program1 | program2

JS> and call that shell script as your piped logger.

yes, I thought about this solution too, but it's not the same. If I
use a shell skript, I have to read the STDIN and start the pipe
process for each log line. This is not the same behaviour, as piping
the whole log stream.

best regards,
Michael Michalowski



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] difference of piped logs in Apache 1.3x and 2.x

Posted by Joshua Slive <jo...@slive.ca>.
Michael Michalowski wrote:
> So, here is an example which worked in Apache 1.3x:
> 
> CustomLog "| program1 | program2" format
> 
> It gives the logstream to the first program "program1" and this
> programm pipes it's output to the second program "program2". This
> definitely worked in Apache 1.3x, but an Apache 2 makes '| program2'
> to a simple parameter list of program1 (no more shell interpolation).

Yes, I have seen other similar reports about not having a full shell on 
the piped loggers in apache 2.  I have some recollection of this being 
fixed at some point, but I'm not sure.

In any case, you can always create a small shell script that simply does
#!/bin/sh
program1 | program2

and call that shell script as your piped logger.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org