Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Filtering the error.log without recompiling? |
|
Author |
|
danbv
Joined: 28 Mar 2008 Posts: 2 Location: Boston, MA
|
Posted: Fri 28 Mar '08 16:47 Post subject: Filtering the error.log without recompiling? |
|
|
Is there an easy way to filter messages so they do not appear in the Apache error.log file, without modifying source code and recompiling? (On Windows 2003 Server.) I want to remove some useless messages that are spamming up the logs:
1. This error from the PHP mssql package, which isn't really an error:
[Thu Mar 27 21:16:43 2008] [error] [client nn.nn.nn.nn] Query: Changed database context to 'databasename'.
2. This error about having a colon in the URL, which is perfectly legal in MediaWiki:
[Thu Mar 27 21:17:37 2008] [error] [client nn.nn.nn.nn] (20024)The given path misformatted or contained invalid characters: Cannot map GET /wiki/Special:Specialpages HTTP/1.1 to file, referer: http://wikiname/wiki/wikiarticle
I tried running the messages through a perl script:
ErrorLog "|perl c:/perl/bin/vp-apache-logger c:/apache2/logs/error2.log"
where the script looks like this:
#!c:\perl\bin\perl
#########################################################
# Quick wrapper for apache logging to eliminate log spam
#########################################################
my @bad_patterns =
(
"The given path misformatted or contained invalid characters:"
);
my $logfile = $ARGV[0];
open(FP, ">>$logfile") or die("Cannot append to $logfile");
foreach my $line (<STDIN>) {
for my $pattern (@bad_patterns) {
if ($line !~ /$pattern/) {
print FP "x $line";
}
}
}
close(FP);
but this is not great, because the log messages get buffered and don't appear quickly enough (or sometimes don't seem to appear at all).
Any suggestions for a better approach?
Thanks. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 07 Apr '08 20:51 Post subject: |
|
|
With mod_rewrite the : should work like on other pages
Also you can configure your error log in httpd.conf and you can turn of error logging from php in your php.ini
If you still have a question please ask again.
Mario |
|
Back to top |
|
danbv
Joined: 28 Mar 2008 Posts: 2 Location: Boston, MA
|
Posted: Mon 07 Apr '08 22:09 Post subject: |
|
|
Thanks Mario. Do you have any specific examples?
- How can mod_rewrite solve this problem? The colons are necessary for MediaWiki pages like Special:Allpages and Help:Contents.
- You say we can "configure error log in httpd.conf". That is what I tried to do in my original post. If you have another way to configure it, that would be very helpful.
- Turning off error logging in php.ini is not so good, because I want to see real PHP errors. Just not this one PHP error about databases.
Thanks! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
|
|
|
|
|