You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Haase-Thomas <mh...@meome-ag.de> on 2002/02/08 10:44:25 UTC

[Q] RewriteMap

Hi all,

it is the first time I'm trying to implement a RewriteMap, and although 
I have some experience with regular expressions, something's going 
wrong. Maybe some of you got the answer - so here's my prob:

apache 1.3.22 on Debian Linux 2.4.17

httpd.conf:

    ServerName disp05
   ...
    RewriteEngine On
    RewriteLogLevel 4
    RewriteLog /var/log/apache/disp05/rewrite_log

    RewriteMap shortnames txt:/etc/apache/shortnames.txt
    RewriteCond %{REQUEST_FILENAME} /\w+
    RewriteRule (.*) ${shortnames:$1} [T=text/html,R=permanent,L]

As you may presume already, shortnames.txt looks like:
gesundheit http://disp05/app/jsp/categoryoverview_jsp/57285.html
hobby http://disp05/app/jsp/categoryoverview_jsp/85300.html
and so on

Now two strange things happen:
1. The RewriteCond doesn't match as it should do. For instance, if I 
send a request for 'http://disp05/hobby' it doesn't match.
2. If I change the condition (to an expression that always matches) 
applying the RewriteRule delivers 'http://disp05/' - which is absolutely 
not what it should do.

Well, maybe all this happens just because it's friday, but nevertheless:
has anyone got an idea what's going wrong?

Many thanx in advance
Martin



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: [Q] RewriteMap

Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
As I found out, apache doesn't tell much more with a loglevel higher than 4.
But thanx for the regex libs tip - I know them only from the perl side.

Martin


Joshua Slive wrote:

>>From: Martin Haase-Thomas [mailto:mht@meome-ag.de]
>>
>
>>Ok, forget about my post. mod_rewrite seems to be at least a little
>>buggy: doesn't understand \w, but [a-zA-Z0-9] instead...
>>
>
>Not all regex libraries are the same.  Apache 1.3 uses HSRegex or your
>system regex library (egrep-style) not perl regex.
>
>As for your original question, please start by using the RewriteLog with a
>high RewriteLogLevel to help you debug.
>
>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
>For additional commands, e-mail: users-help@httpd.apache.org
>
>


Re: rotate log file daily

Posted by Kyle <ky...@ccidomain.com>.
I use cron to run a perl script that processes the log files for all of
my vhosts.  The script is based upon the apache doc:
http://httpd.apache.org/docs/logs.html#rotation
I have found that if you use a statistical viewer like webalizer (in my
case), that the apache docs on log rotation works much better than using
the piped logs.

-Kyle

zliu1 wrote:
> 
> Is there a way to rotate Apache log file daily always at the local time
> 23:59:59, and to name the old log file as access_log.YYYYMMDD?
> 
> Thanks,
> Zuwei
> 
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: rotate log file daily

Posted by jon schatz <jo...@divisionbyzero.com>.
On Fri, 2002-02-08 at 07:03, zliu1 wrote:
> Is there a way to rotate Apache log file daily always at the local time
> 23:59:59, and to name the old log file as access_log.YYYYMMDD? 

you want logrotate(8), which is included with most linux distros and is
probably ported to other unices as well.

-jon

-- 
jon@divisionbyzero.com || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus?: www.divisionbyzero.com/pgp.html
"You are in a twisty little maze of Sendmail rules, all confusing." 

Re: rotate log file daily

Posted by Vernon A Webb <Ve...@net-nation.com>.
Here's what I do and it gives me something like:

access_log.1013126400 for today, which I have no idea how 
that translates.

CustomLog "|rotatelogs /home/www/pub/logs/access_log 86400" 
common

If anyone knows how to make it come out as zliu1 suggests, 
I'd like to know that, better yet I would like to get it 
monthly and not daily.


-----Original Message-----
From: zliu1 <zl...@nd.edu>
To: users@httpd.apache.org
Date: Fri, 8 Feb 2002 10:03:15 -0500 (EST)
Subject: rotate log file daily

> 
> Is there a way to rotate Apache log file daily always at 
the local time
> 23:59:59, and to name the old log file as 
access_log.YYYYMMDD? 
> 
> Thanks,
> Zuwei
> 
> 
> ----------------------------------------------------------
-----------
> 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
> For additional commands, e-mail: users-
help@httpd.apache.org
> 



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


rotate log file daily

Posted by zliu1 <zl...@nd.edu>.
Is there a way to rotate Apache log file daily always at the local time
23:59:59, and to name the old log file as access_log.YYYYMMDD? 

Thanks,
Zuwei


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: [Q] RewriteMap

Posted by Joshua Slive <jo...@slive.ca>.
> From: Martin Haase-Thomas [mailto:mht@meome-ag.de]

> Ok, forget about my post. mod_rewrite seems to be at least a little
> buggy: doesn't understand \w, but [a-zA-Z0-9] instead...

Not all regex libraries are the same.  Apache 1.3 uses HSRegex or your
system regex library (egrep-style) not perl regex.

As for your original question, please start by using the RewriteLog with a
high RewriteLogLevel to help you debug.

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
For additional commands, e-mail: users-help@httpd.apache.org


Re: [Q] RewriteMap

Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
Ok, forget about my post. mod_rewrite seems to be at least a little 
buggy: doesn't understand \w, but [a-zA-Z0-9] instead...


Martin Haase-Thomas wrote:

> Hi all,
>
> it is the first time I'm trying to implement a RewriteMap, and 
> although I have some experience with regular expressions, something's 
> going wrong. Maybe some of you got the answer - so here's my prob:
>
> apache 1.3.22 on Debian Linux 2.4.17
>
> httpd.conf:
>
>    ServerName disp05
>   ...
>    RewriteEngine On
>    RewriteLogLevel 4
>    RewriteLog /var/log/apache/disp05/rewrite_log
>
>    RewriteMap shortnames txt:/etc/apache/shortnames.txt
>    RewriteCond %{REQUEST_FILENAME} /\w+
>    RewriteRule (.*) ${shortnames:$1} [T=text/html,R=permanent,L]
>
> As you may presume already, shortnames.txt looks like:
> gesundheit http://disp05/app/jsp/categoryoverview_jsp/57285.html
> hobby http://disp05/app/jsp/categoryoverview_jsp/85300.html
> and so on
>
> Now two strange things happen:
> 1. The RewriteCond doesn't match as it should do. For instance, if I 
> send a request for 'http://disp05/hobby' it doesn't match.
> 2. If I change the condition (to an expression that always matches) 
> applying the RewriteRule delivers 'http://disp05/' - which is 
> absolutely not what it should do.
>
> Well, maybe all this happens just because it's friday, but nevertheless:
> has anyone got an idea what's going wrong?
>
> Many thanx in advance
> Martin
>
>
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org