Quantcast

logformat and emulate_httpd_log

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

logformat and emulate_httpd_log

Emilio Casbas
Related to this mail
http://www.mail-archive.com/squid-users@.../msg45846.html

We have a logformat configured such as:
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %>st
"%{Referer}>h" "%{User-Agent}>h" "%{Cookie}>h"

and the log looks like:

X.X.X.74 - - [15/May/2007:17:09:40 +0200] "GET
http://X.X.X.60/SI/images/servicios/normasdeuso/normas.swf HTTP/1.0" 200
846 "http://X.X.X.60/SI/servicios/normasdeuso/" "Mozilla/5.0 (Windows;
U; Windows NT 5.1; es-ES; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"
"__utma=195368044.1974944821.1178892272.1179143335.1179241055.6;
__utmz=195368044.1179143335.5.4.utmccn=(referral)|utmcsr=X.X.X.122|utmcct=/index.html.es|utmcmd=referral;
__utmc=195368044; __utmb=195368044"

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

is it possible?

Thanks
Emilio C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: logformat and emulate_httpd_log

Henrik Nordström
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

signature.asc (316 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: logformat and emulate_httpd_log

Emilio Casbas
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
Loading...