Format of log

Discussion in 'General' started by damienm, Jun 27, 2012.

  1. damienm

    damienm New Member

    Hi,

    for the log format the server states

    "The syntax of log format is compatible with Apache 2.0's custom log format."

    However it appears some things are unsupported, or have bugs?

    Per the apache 2.0 documentation there are some things not functioning.
    http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#formats

    1) I am interested in outputting environmental variables after setting them in a rewrite, for example:

    %{FOOBAR}e

    From apache:
    "%...{FOOBAR}e The contents of the environment variable FOOBAR"

    I can never get the variable output in the log though I can confirm it is set in the environment.

    2) I also wish to use the < > modifiers with %U

    %>U and %<U

    From apache:
    "The modifiers "<" and ">" can be used for requests that have been internally redirected to choose whether the original or final (respectively) request should be consulted. By default, the % directives %s, %U"

    The modifiers seem to have no effect.

    cheers for your assistance
  2. NiteWave

    NiteWave Administrator

    1) try in .htaccess

    RewriteRule \.php$ - [E=isPHP:1]

    this set environment variable "isPHP"

    in log format, add %{isPHP}e

    will look into 2) later.
  3. NiteWave

    NiteWave Administrator

    my test result regarding 2) on latest 4.1.13:

    %<U --- not work, will simply leave U in log file
    %U equal to %>U, the final request URI.

    test env:
    .htaccess:
    RewriteRule abc.html test.php

    when access 127.0.0.1/abc.html?c=3&d=5, the log for "%r" %<U %U %>U is:
    "GET /abc.html?c=3&d=5 HTTP/1.1" U /test.php /test.php
    i.e.,
    "%r" --> "GET /abc.html?c=3&d=5 HTTP/1.1"
    %<U --> U
    %U --> /test.php
    %>U --> /test.php

Share This Page