Re: CustomLog to a pipe question

Leonardo Herrera <[email protected]> Thu, 06 Nov 2003 12:12:43 -0300
Newsgroups gmane.comp.apache.mod-log-spread.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------090304040008040505060100
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Leonardo Herrera wrote:
> Hi, I have a question. Does mod_log_spread support logging to a pipe 
> instead of file in the CustomLog directive? I tried to do this without 
> result, for example
> 
>  SpreadDaemon 4803
>  CustomLog "|/bin/rotatelogs /logs/access_log 300" common
>  CustomLog $hits common

I hate to reply to myself, but I found the problem. There is a small bug 
in mod_log_spread.c that disallowed to use piped log files. I've 
attached a diff file (actually, the fix is to add a missing "else" in 
open_config_log(), the rest is purely cosmetic)

Regards,
-- 
Leonardo Herrera L.
mailto:[email protected]

--------------090304040008040505060100
Content-Type: text/plain;
 name="diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="diff.txt"

leus@desarrollo:~/spread/mod_log_spread-1.0.4> diff mod_log_spread.c.orig mod_log_spread.c
1393,1399c1393,1399
<     }
<     /* Ignore spread descriptors now, pick them up in child init */
<     if (*cls->fname == '$') {
<         parse_spread_groupname(s, cls);
<         /* FIXME: bug why return here, why not wait for return at end of function? */
<       return cls;
<     }
---
>     } else {
>         /* Ignore spread descriptors now, pick them up in child init */
>         if (*cls->fname == '$') {
>             parse_spread_groupname(s, cls);
>             /* FIXME: bug why return here, why not wait for return at end of function? */
>           return cls;
>         }
1401,1406c1401,1407
<     else {
<         char *fname = ap_server_root_relative(p, cls->fname);
<         if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
<             ap_log_error(APLOG_MARK, APLOG_ERR, s,
<                          "could not open transfer log file %s.", fname);
<             exit(1);
---
>         else {
>             char *fname = ap_server_root_relative(p, cls->fname);
>             if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
>                 ap_log_error(APLOG_MARK, APLOG_ERR, s,
>                              "could not open transfer log file %s.", fname);
>                 exit(1);
>             }
leus@desarrollo:~/spread/mod_log_spread-1.0.4> 
--------------090304040008040505060100--