Re: [squid-users] logformat and emulate_httpd_log

From: Emilio Casbas <ecasbas@dont-contact.us>
Date: Thu, 17 May 2007 12:27:01 +0200

Henrik Nordstrom escribió:
> tis 2007-05-15 klockan 17:27 +0200 skrev Emilio Casbas:
>
>> But we need a "%ru" parameter like the httpd native log, that is showing;
>> /SI/images/servicios/normasdeuso/normas.swf instead of
>> http://X.X.X.60/SI/images/servicios/normasdeuso/normas.swf
>
> This is not implemented yet. Patches adding this format is welcome.
>
> Regards
> Henrik

I have done a small patch to have a new "rp" format code in order to
show only the urlpath in the access log.
For us it's working correctly, but I'm not sure about the patch
construction, due it's the first patch I have made.

Thanks
Emilio C.

--- squid-2.6.STABLE13/src/access_log.c 2007-02-03 21:59:24.000000000 +0000
+++ squid-2.6.STABLE13-MOD/src/access_log.c 2007-05-17
09:23:19.000000000 +0000
@@ -297,6 +297,7 @@

      LFT_REQUEST_METHOD,
      LFT_REQUEST_URI,
+ LFT_REQUEST_URLPATH,
  /*LFT_REQUEST_QUERY, * // * this is not needed. see strip_query_terms */
      LFT_REQUEST_VERSION,

@@ -400,6 +401,7 @@

      {"rm", LFT_REQUEST_METHOD},
      {"ru", LFT_REQUEST_URI}, /* doesn't include the query-string */
+ {"rp", LFT_REQUEST_URLPATH}, /* doesn't include the host */
  /* { "rq", LFT_REQUEST_QUERY }, * / / * the query-string,
INCLUDING the leading ? */
      {">v", LFT_REQUEST_VERSION},
      {"rv", LFT_REQUEST_VERSION},
@@ -632,6 +634,11 @@
              out = al->url;
              break;

+ case LFT_REQUEST_URLPATH:
+ out = strBuf(al->request->urlpath);
+ quote = 1;
+ break;
+
          case LFT_REQUEST_VERSION:
              snprintf(tmp, sizeof(tmp), "%d.%d", (int) al->http.version.major,
(int) al->http.version.minor);
              out = tmp;
--- squid-2.6.STABLE13/src/cf.data.pre 2007-04-24 21:30:03.000000000 +0000
+++ squid-2.6.STABLE13-MOD/src/cf.data.pre 2007-05-16 15:51:36.000000000
+0000
@@ -1270,6 +1270,7 @@
                  mt MIME content type
                  rm Request method (GET/POST etc)
                  ru Request URL
+ rp Request URLPATH (like the apache log)
                  rv Request protocol version
                  ea Log string returned by external acl
                  <st Reply size including HTTP headers
Received on Thu May 17 2007 - 04:27:26 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:05 MDT