2

While attempting to migrate my apache 2.2 webserver to apache 2.4 I an unable to transform this particular snippet.

RewriteEngine On
RewriteLogLevel 0
RewriteLog "logs/rewrite_80.log"

What would the apache 2.4 compatible code for this be.

3
  • 1
  • yes, I have gone through that document and wasn't able to understand how the logs are getting redirected to a file. From what I understood, i am using tail on the error log and then grep for a string. but how to redirect it to a new file.
    – debal
    Jul 17, 2017 at 18:12
  • that tail part looks like it needs to be executed on a shell, how to make the configuration such that rewrite logs are sent into a separate file.
    – debal
    Jul 17, 2017 at 18:29

1 Answer 1

0

I too am saddened by this discovery, but it looks like this capability (logging rewrites to a separate log file) was removed in Apache 2.4.

The suggestion in the documentation, referred to in the comments above, is to increase the log level specifically for mod_rewrite with something like this

# note that the example in the docs combines this with 'LogLevel alert'
# you can do them separately, too
LogLevel rewrite:trace3

…and then extract the specific log messages from the ErrorLog file for the server/vhost using a Unix shell command like

tail -f error_log | fgrep '[rewrite:'

The Windows rendition of that would probably involve FINDSTR or some equivalent PowerShell commands. (Not my area of expertise, apologies.)

Note that the module won't log anything at all up to a level of debug, so the rewrite:traceN really is necessary if you want to troubleshoot your rewrites:

mod_rewrite offers detailed logging of its actions at the trace1 to trace8 log levels. The log level can be set specifically for mod_rewrite using the LogLevel directive: Up to level debug, no actions are logged, while trace8 means that practically all actions are logged.

references: 1 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .