Return-Path: X-Original-To: apmail-trafficserver-dev-archive@www.apache.org Delivered-To: apmail-trafficserver-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 921E91050D for ; Thu, 10 Apr 2014 09:09:12 +0000 (UTC) Received: (qmail 10754 invoked by uid 500); 10 Apr 2014 09:09:11 -0000 Delivered-To: apmail-trafficserver-dev-archive@trafficserver.apache.org Received: (qmail 10443 invoked by uid 500); 10 Apr 2014 09:09:09 -0000 Mailing-List: contact dev-help@trafficserver.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@trafficserver.apache.org Delivered-To: mailing list dev@trafficserver.apache.org Received: (qmail 10428 invoked by uid 99); 10 Apr 2014 09:09:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2014 09:09:07 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yunkai.me@gmail.com designates 74.125.83.42 as permitted sender) Received: from [74.125.83.42] (HELO mail-ee0-f42.google.com) (74.125.83.42) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2014 09:09:03 +0000 Received: by mail-ee0-f42.google.com with SMTP id d17so2770154eek.29 for ; Thu, 10 Apr 2014 02:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NLR7WVF15wFMQEC9X6sFF5KdwQkauJU8ijl6DUG6eDY=; b=y1ibVsVqCkh9rBQzgF/AkEy1rTWdoOCP0V8FMdaZlosprmDihcMCjun38QkEZZsva5 PWRtOzVwqDPGgSLJHbZKSq70/zzjvftusSwu5k/yB50O05qrYiK7geXmfrcJjzi2A+pR HBCwRBQVdc4xlslbPkZpiM2bDlAO8Q7iyPR5TFNy8Br7NyHmWQKItXpOMxeoa9RcCXmK uSLGzyoQetAT1iRLfTQl/A+OObrFDRaDQz1hqjzsV91G8+Xsu/pPzX4UvnEIalAZv9jv VIG/9ROjGLQkuy49LGcoJITClPYUFEih6o4YDDVFQA0A9Rei8Gcf8DNa1njRztIjUF5w WTjQ== MIME-Version: 1.0 X-Received: by 10.15.35.66 with SMTP id f42mr39041eev.93.1397120921467; Thu, 10 Apr 2014 02:08:41 -0700 (PDT) Received: by 10.14.88.6 with HTTP; Thu, 10 Apr 2014 02:08:41 -0700 (PDT) In-Reply-To: <2004367.N2HCaHtuJi@h2o.as.studentenwerk.mhn.de> References: <5224911.EMokxy7UDg@ei.h3.stusta.mhn.de> <2004367.N2HCaHtuJi@h2o.as.studentenwerk.mhn.de> Date: Thu, 10 Apr 2014 17:08:41 +0800 Message-ID: Subject: Re: Logging: add % and % From: Yunkai Zhang To: Wolfgang Walter Cc: dev-trafficserver Content-Type: multipart/alternative; boundary=089e0160c8c03b7f7204f6ac909f X-Virus-Checked: Checked by ClamAV on apache.org --089e0160c8c03b7f7204f6ac909f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Apr 10, 2014 at 5:00 PM, Wolfgang Walter wro= te: > Am Donnerstag, 10. April 2014, 10:29:27 schrieb Yunkai Zhang: > > Why we need to log these information? > > We here need them to distinquish how the client used the proxy. We have > different ips (and ports) for explicit and transparent use. > gotacha. How about naming them "virtual_server_{ip|port}" or other more sutiable names ? > > > > > And there are client_host_{ip|port}, the name of client_server_{ip|port= } > > are really confusing me. > > > > On Thu, Apr 10, 2014 at 4:28 AM, Wolfgang Walter > wrote: > > > From a625520d878e455a62f2f890920915e482d36e73 Mon Sep 17 00:00:00 200= 1 > > > From: Wolfgang Walter > > > Date: Sun, 6 Apr 2014 13:20:07 +0200 > > > Subject: [PATCH 5/6] Logging: add % and % > > > > > > csi logs the ip address (which is one of the Traffic Server) the clie= nt > > > request arrived. > > > > > > csp logs the port the client request arrived. > > > --- > > > > > > proxy/http/HttpSM.cc | 1 + > > > proxy/logging/Log.cc | 15 +++++++++++++++ > > > proxy/logging/LogAccess.cc | 18 ++++++++++++++++++ > > > proxy/logging/LogAccess.h | 2 ++ > > > proxy/logging/LogAccessHttp.cc | 22 ++++++++++++++++++++++ > > > proxy/logging/LogAccessHttp.h | 2 ++ > > > 6 files changed, 60 insertions(+) > > > > > > diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc > > > index 2a65209..b45d5ba 100644 > > > --- a/proxy/http/HttpSM.cc > > > +++ b/proxy/http/HttpSM.cc > > > @@ -544,6 +544,7 @@ HttpSM::attach_client_session(HttpClientSession * > > > client_vc, IOBufferReader * bu > > > > > > ats_ip_copy(&t_state.client_info.addr, netvc->get_remote_addr()); > > > t_state.client_info.port =3D netvc->get_local_port(); > > > > > > + ats_ip_copy(&t_state.client_info.local_addr, > netvc->get_local_addr()); > > > > > > t_state.client_info.is_transparent =3D netvc->get_is_transparent()= ; > > > t_state.backdoor_request =3D client_vc->backdoor_connect; > > > t_state.client_info.port_attribute =3D > > > > > > static_cast(netvc->attributes); > > > diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc > > > index fe671d0..1a8d6bd 100644 > > > --- a/proxy/logging/Log.cc > > > +++ b/proxy/logging/Log.cc > > > @@ -358,6 +358,21 @@ Log::init_fields() > > > > > > global_field_list.add(field, false); > > > ink_hash_table_insert(field_symbol_hash, "chih", field); > > > > > > + field =3D NEW(new LogField("client_server_ip", "csi", > > > + LogField::IP, > > > + &LogAccess::marshal_client_server_ip, > > > + &LogAccess::unmarshal_ip_to_str)); > > > + global_field_list.add(field, false); > > > + ink_hash_table_insert(field_symbol_hash, "csi", field); > > > + > > > + field =3D NEW(new LogField("client_server_port", "csp", > > > + LogField::sINT, > > > + &LogAccess::marshal_client_server_port, > > > + &LogAccess::unmarshal_int_to_str)); > > > + global_field_list.add(field, false); > > > + ink_hash_table_insert(field_symbol_hash, "csp", field); > > > + > > > + > > > > > > field =3D NEW (new LogField ("client_auth_user_name", "caun", > > > > > > LogField::STRING, > > > > &LogAccess::marshal_client_auth_user_name, > > > > > > diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc > > > index 9a14391..004dfc9 100644 > > > --- a/proxy/logging/LogAccess.cc > > > +++ b/proxy/logging/LogAccess.cc > > > @@ -99,6 +99,24 @@ LogAccess::marshal_client_host_port(char *buf) > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > int > > > > > > +LogAccess::marshal_client_server_ip(char *buf) > > > +{ > > > + DEFAULT_IP_FIELD; > > > +} > > > + > > > > > > > +/*----------------------------------------------------------------------= - > > > -- + > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > + > > > +int > > > +LogAccess::marshal_client_server_port(char *buf) > > > +{ > > > + DEFAULT_INT_FIELD; > > > +} > > > + > > > > > > > +/*----------------------------------------------------------------------= - > > > -- + > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > + > > > +int > > > > > > LogAccess::marshal_client_auth_user_name(char *buf) > > > { > > > > > > DEFAULT_STR_FIELD; > > > > > > diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h > > > index 2ef5ca5..568f14f 100644 > > > --- a/proxy/logging/LogAccess.h > > > +++ b/proxy/logging/LogAccess.h > > > > > > @@ -169,6 +169,8 @@ public: > > > // > > > inkcoreapi virtual int marshal_client_host_ip(char *); // S= TR > > > inkcoreapi virtual int marshal_client_host_port(char *); // I= NT > > > > > > + inkcoreapi virtual int marshal_client_server_ip(char *); // > STR > > > + inkcoreapi virtual int marshal_client_server_port(char *); // > INT > > > > > > inkcoreapi virtual int marshal_client_auth_user_name(char *); // S= TR > > > int marshal_client_req_timestamp_sec(char *); // INT > > > > > > diff --git a/proxy/logging/LogAccessHttp.cc > > > b/proxy/logging/LogAccessHttp.cc > > > index 8d82aab..9fd4370 100644 > > > --- a/proxy/logging/LogAccessHttp.cc > > > +++ b/proxy/logging/LogAccessHttp.cc > > > @@ -167,6 +167,28 @@ LogAccessHttp::marshal_client_host_port(char *bu= f) > > > > > > } > > > > > > > > > > /*----------------------------------------------------------------------= - > > > -- > > > > > > + > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > + > > > +int > > > +LogAccessHttp::marshal_client_server_ip(char *buf) > > > +{ > > > + return marshal_ip(buf, &m_http_sm-> > t_state.client_info.local_addr.sa); > > > +} > > > + > > > > > > > +/*----------------------------------------------------------------------= - > > > -- + > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > + > > > +int > > > +LogAccessHttp::marshal_client_server_port(char *buf) > > > +{ > > > + if (buf) { > > > + uint16_t port =3D ats_ip_port_host_order(&m_http_sm-> > > > t_state.client_info.local_addr.sa); > > > + marshal_int(buf, port); > > > + } > > > + return INK_MIN_ALIGN; > > > +} > > > + > > > > > > > +/*----------------------------------------------------------------------= - > > > --> > > > user authenticated to the proxy (RFC931) > > > > > > > ------------------------------------------------------------------------= - > > > */ > > > > > > diff --git a/proxy/logging/LogAccessHttp.h > b/proxy/logging/LogAccessHttp.h > > > index 133cd94..980c5c7 100644 > > > --- a/proxy/logging/LogAccessHttp.h > > > +++ b/proxy/logging/LogAccessHttp.h > > > > > > @@ -57,6 +57,8 @@ public: > > > // > > > virtual int marshal_client_host_ip(char *); // STR > > > virtual int marshal_client_host_port(char *); // INT > > > > > > + virtual int marshal_client_server_ip(char *); // STR > > > + virtual int marshal_client_server_port(char *); // INT > > > > > > virtual int marshal_client_auth_user_name(char *); // STR > > > virtual int marshal_client_protocol_stack(char *); // INT > > > virtual int marshal_client_req_text(char *); // STR > > > > > > -- > > > 1.9.1 > > Regards, > -- > Wolfgang Walter > Studentenwerk M=FCnchen > Anstalt des =F6ffentlichen Rechts > --=20 Yunkai Zhang Work at Taobao --089e0160c8c03b7f7204f6ac909f--