It is currently Fri, 24 May 2013 13:36:42 GMT



 
Author Message
 Filtering the error.log (Apache 1.3)
I've a site (Apache) that is called every 2 minutes to check it is up
(and if not, email is sent and pagers are alerted). It does this by
asking for the "webping" URL.

There is no such page, so an error message goes back (enough to show
the server is running), and an entry is added to the error log.

Is there a way to stop this particular page being added to the error
log, as the genuine error messages are going unnoticed. I could create
a "webping" page, but then it's going into access.log and counting as
a hit, which is also undesirable.

Any ideas?

Darren



 Fri, 23 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)

You may change the source code in src/main/http_core.c at line 2738
********* from
    if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
        char *emsg;

        emsg = "File does not exist: ";
        if (r->path_info == NULL) {
            emsg = ap_pstrcat(r->pool, emsg, r->filename, NULL);
        }
        else {
            emsg = ap_pstrcat(r->pool, emsg, r->filename,
r->path_info, NULL);
        }
        ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r, emsg);
        ap_table_setn(r->notes, "error-notes", emsg);
        return HTTP_NOT_FOUND;
    }
********* to
    if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
        char *emsg;

        emsg = "File does not exist: ";
        if (r->path_info == NULL) {
            emsg = ap_pstrcat(r->pool, emsg, r->filename, NULL);
        }
        else {
            emsg = ap_pstrcat(r->pool, emsg, r->filename,
r->path_info, NULL);
        }
        if (r->filename eq "g:/apache/www/q.html") {
        /* here you can write in another file or anything else

           the condition must exactly and uses the true filename not
the URI
           r->uri or r->unparsed_uri may be better            
           because it is independent from the phyiscal storage
        */
           }
        else {
           ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, r,
emsg);
           ap_table_setn(r->notes, "error-notes", emsg);
           }
        return HTTP_NOT_FOUND;
    }

On Mon, 05 Oct 1998 03:56:17 GMT, dar...@factcomm.NOSPAM.co.jp (Darren

---------------------------
Andreas Grueninger

PRIVATE: gru...@stuttgart.netsurf.de
 OFFICE: gruenin...@lfl.bwl.de
---------------------------



 Fri, 23 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
That's an interesting thing...
Where do I have to make changes if I want to prevent entries in the
access.log? (I don't want to have loggeg accesses to *.gif and *.jpg
files)

Thanks
Michael



 Fri, 23 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
In <3618911d.4733...@news.lf.net> gru...@stuttgart.netsurf.de (Andreas Grueninger) writes:

You can change the code to say that, but don't expect it to compile
since that isn't valid LISP.  Well, it isn't valid C either.

The easiest solution would be to used a piped error log (see the
ErrorLog docs for how to set it up using |program) and have your
program filter whateve rit wants.



 Fri, 23 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
In <3618E403.7EEE3...@f30x.erl.scn.de> Michael Heimbach <hm3...@f30x.erl.scn.de> writes:

Use a piped log.  See the TransferLog docs for details.

Then you can have your program arbitrarily filter anything you want,
rot13 all your logfiles, change the datestamp to look like
it is from 1923, etc.



 Fri, 23 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
I was editing SAS and Perl scripts before and there it is 'eq' what is
'==' in C. This will compile (of course after deleting the lines
between /* and */).
        if (r->filename == "g:/apache/www/q.html") {

---------------------------
Andreas Grueninger

PRIVATE: gru...@stuttgart.netsurf.de
 OFFICE: gruenin...@lfl.bwl.de
---------------------------



 Sun, 25 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
In <361911a7.37639...@news.lf.net> gru...@stuttgart.netsurf.de (Andreas Grueninger) writes:

Good try, but it still won't quote work.

Hint: strcmp.

You are far better off just logging to a pipe and letting it filter.



 Sun, 25 Mar 2001 03:00:00 GMT   
 Filtering the error.log (Apache 1.3)
Now we got it. Seems to be a very inefficient way to come to a
solution. Thank you, Marc.
if(strcmpi(r->filename,"g:/apache/www/q.html")==0)  (thanks Darren)
Of course you are right, filtering with a pipe is much more better
because its flexibility. But it takes more resources.

---------------------------
Andreas Grueninger

PRIVATE: gru...@stuttgart.netsurf.de
 OFFICE: gruenin...@lfl.bwl.de
---------------------------



 Mon, 26 Mar 2001 03:00:00 GMT   
 
   [ 8 post ] 

Similar Threads

1. Apache 1.3 FreeBSD and MMap in error log file

2. apache 1.30: error in log files, possible bug?

3. log complete request header in apache 1.3?

4. apache 1.3 and remote logging

5. Apache 1.3 log rotation and multiple users

6. Apache 1.3: suexec.log

7. Apache 1.3 startup error

8. 500 Internal server error in apache 1.3

9. Apache 1.3 and server-status returning Permission error

10. Apache 1.3 - won't start - semctl(IPC_SET) error


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software