You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2013/11/20 18:50:58 UTC
Re: git commit: Add a new field: '%',
"client_host_port" to LogFormat
What JIRA ticket is this?
On Nov 20, 2013, at 6:27 AM, yunkai@apache.org wrote:
> Updated Branches:
> refs/heads/master 938fa1ec2 -> ed8f6e9b0
>
>
> Add a new field: '%<chp>', "client_host_port" to LogFormat
>
> Signed-off-by: Yunkai Zhang <qi...@taobao.com>
>
>
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ed8f6e9b
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ed8f6e9b
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ed8f6e9b
>
> Branch: refs/heads/master
> Commit: ed8f6e9b02170f311992dc5f00f9838b88ec7077
> Parents: 938fa1e
> Author: Yunkai Zhang <qi...@taobao.com>
> Authored: Wed Nov 20 17:45:08 2013 +0800
> Committer: Yunkai Zhang <qi...@taobao.com>
> Committed: Wed Nov 20 22:27:06 2013 +0800
>
> ----------------------------------------------------------------------
> proxy/ICPConfig.cc | 6 ++++++
> proxy/ICPlog.h | 1 +
> proxy/logging/Log.cc | 7 +++++++
> proxy/logging/LogAccess.cc | 9 +++++++++
> proxy/logging/LogAccess.h | 1 +
> proxy/logging/LogAccessHttp.cc | 13 +++++++++++++
> proxy/logging/LogAccessHttp.h | 1 +
> proxy/logging/LogAccessICP.cc | 13 +++++++++++++
> proxy/logging/LogAccessICP.h | 3 ++-
> 9 files changed, 53 insertions(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPConfig.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
> index 01523f2..3e19557 100644
> --- a/proxy/ICPConfig.cc
> +++ b/proxy/ICPConfig.cc
> @@ -1301,6 +1301,12 @@ ICPlog::GetClientIP()
> return &_s->_sender.sa;
> }
>
> +in_port_t
> +ICPlog::GetClientPort()
> +{
> + return _s->_sender.port();
> +}
> +
> SquidLogCode ICPlog::GetAction()
> {
> if (_s->_queryResult == CACHE_EVENT_LOOKUP)
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPlog.h
> ----------------------------------------------------------------------
> diff --git a/proxy/ICPlog.h b/proxy/ICPlog.h
> index a5e01d9..f7f37e9 100644
> --- a/proxy/ICPlog.h
> +++ b/proxy/ICPlog.h
> @@ -52,6 +52,7 @@ public:
> }
> ink_hrtime GetElapsedTime();
> sockaddr const* GetClientIP();
> + in_port_t GetClientPort();
> SquidLogCode GetAction();
> const char *GetCode();
> int GetSize();
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/Log.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
> index 546f83f..6a64ce7 100644
> --- a/proxy/logging/Log.cc
> +++ b/proxy/logging/Log.cc
> @@ -346,6 +346,13 @@ Log::init_fields()
> global_field_list.add(field, false);
> ink_hash_table_insert(field_symbol_hash, "chi", field);
>
> + field = NEW(new LogField("client_host_port", "chp",
> + LogField::sINT,
> + &LogAccess::marshal_client_host_port,
> + &LogAccess::unmarshal_int_to_str));
> + global_field_list.add(field, false);
> + ink_hash_table_insert(field_symbol_hash, "chp", field);
> +
> field = NEW(new LogField("client_host_ip_hex", "chih",
> LogField::IP,
> &LogAccess::marshal_client_host_ip,
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccess.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
> index 4254569..60fc53c 100644
> --- a/proxy/logging/LogAccess.cc
> +++ b/proxy/logging/LogAccess.cc
> @@ -84,6 +84,15 @@ LogAccess::marshal_client_host_ip(char *buf)
> -------------------------------------------------------------------------*/
>
> int
> +LogAccess::marshal_client_host_port(char *buf)
> +{
> + DEFAULT_INT_FIELD;
> +}
> +
> +/*-------------------------------------------------------------------------
> + -------------------------------------------------------------------------*/
> +
> +int
> LogAccess::marshal_client_auth_user_name(char *buf)
> {
> DEFAULT_STR_FIELD;
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccess.h
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
> index eb10824..4438f7b 100644
> --- a/proxy/logging/LogAccess.h
> +++ b/proxy/logging/LogAccess.h
> @@ -168,6 +168,7 @@ public:
> // client -> proxy fields
> //
> inkcoreapi virtual int marshal_client_host_ip(char *); // STR
> + inkcoreapi virtual int marshal_client_host_port(char *); // INT
> inkcoreapi virtual int marshal_client_auth_user_name(char *); // STR
> int marshal_client_req_timestamp_sec(char *); // INT
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccessHttp.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
> index cc89abc..e527fd6 100644
> --- a/proxy/logging/LogAccessHttp.cc
> +++ b/proxy/logging/LogAccessHttp.cc
> @@ -145,6 +145,19 @@ LogAccessHttp::marshal_client_host_ip(char *buf)
> }
>
> /*-------------------------------------------------------------------------
> + -------------------------------------------------------------------------*/
> +
> +int
> +LogAccessHttp::marshal_client_host_port(char *buf)
> +{
> + if (buf) {
> + uint16_t port = ntohs(m_http_sm->t_state.client_info.addr.port());
> + marshal_int(buf, port);
> + }
> + return INK_MIN_ALIGN;
> +}
> +
> +/*-------------------------------------------------------------------------
> user authenticated to the proxy (RFC931)
> -------------------------------------------------------------------------*/
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccessHttp.h
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
> index 88192d0..4d6abeb 100644
> --- a/proxy/logging/LogAccessHttp.h
> +++ b/proxy/logging/LogAccessHttp.h
> @@ -56,6 +56,7 @@ public:
> // client -> proxy fields
> //
> virtual int marshal_client_host_ip(char *); // STR
> + virtual int marshal_client_host_port(char *); // INT
> virtual int marshal_client_auth_user_name(char *); // STR
> virtual int marshal_client_req_text(char *); // STR
> virtual int marshal_client_req_http_method(char *); // INT
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccessICP.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccessICP.cc b/proxy/logging/LogAccessICP.cc
> index ebdd0df..5f9bb15 100644
> --- a/proxy/logging/LogAccessICP.cc
> +++ b/proxy/logging/LogAccessICP.cc
> @@ -74,6 +74,19 @@ LogAccessICP::marshal_client_host_ip(char *buf)
> -------------------------------------------------------------------------*/
>
> int
> +LogAccessICP::marshal_client_host_port(char *buf)
> +{
> + if (buf) {
> + uint16_t port = ntohs(m_icp_log->GetClientPort());
> + marshal_int(buf, port);
> + }
> + return INK_MIN_ALIGN;
> +}
> +
> +/*-------------------------------------------------------------------------
> + -------------------------------------------------------------------------*/
> +
> +int
> LogAccessICP::marshal_client_auth_user_name(char *buf)
> {
> char *str = (char *) m_icp_log->GetIdent();
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/LogAccessICP.h
> ----------------------------------------------------------------------
> diff --git a/proxy/logging/LogAccessICP.h b/proxy/logging/LogAccessICP.h
> index 158d6bc..74eca8e 100644
> --- a/proxy/logging/LogAccessICP.h
> +++ b/proxy/logging/LogAccessICP.h
> @@ -51,7 +51,8 @@ public:
> //
> // client -> proxy fields
> //
> - virtual int marshal_client_host_ip(char *); // INT
> + virtual int marshal_client_host_ip(char *); // STR
> + virtual int marshal_client_host_port(char *); // INT
> virtual int marshal_client_auth_user_name(char *); // STR
> virtual int marshal_client_req_text(char *); // STR
> virtual int marshal_client_req_http_method(char *); // INT
>
Re: git commit: Add a new field: '%',
"client_host_port" to LogFormat
Posted by James Peach <jp...@apache.org>.
On Nov 20, 2013, at 9:58 AM, Yunkai Zhang <yu...@gmail.com> wrote:
> I wonder it's a small patch, maybe needn't a ticket.
>
> I'm pleasure to create one for it if necessary.
Yes please :)
>
> 在 2013年11月21日星期四,James Peach 写道:
>
>> What JIRA ticket is this?
>>
>> On Nov 20, 2013, at 6:27 AM, yunkai@apache.org wrote:
>>
>>> Updated Branches:
>>> refs/heads/master 938fa1ec2 -> ed8f6e9b0
>>>
>>>
>>> Add a new field: '%<chp>', "client_host_port" to LogFormat
>>>
>>> Signed-off-by: Yunkai Zhang <qi...@taobao.com>
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
>>> Commit:
>> http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ed8f6e9b
>>> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ed8f6e9b
>>> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ed8f6e9b
>>>
>>> Branch: refs/heads/master
>>> Commit: ed8f6e9b02170f311992dc5f00f9838b88ec7077
>>> Parents: 938fa1e
>>> Author: Yunkai Zhang <qi...@taobao.com>
>>> Authored: Wed Nov 20 17:45:08 2013 +0800
>>> Committer: Yunkai Zhang <qi...@taobao.com>
>>> Committed: Wed Nov 20 22:27:06 2013 +0800
>>>
>>> ----------------------------------------------------------------------
>>> proxy/ICPConfig.cc | 6 ++++++
>>> proxy/ICPlog.h | 1 +
>>> proxy/logging/Log.cc | 7 +++++++
>>> proxy/logging/LogAccess.cc | 9 +++++++++
>>> proxy/logging/LogAccess.h | 1 +
>>> proxy/logging/LogAccessHttp.cc | 13 +++++++++++++
>>> proxy/logging/LogAccessHttp.h | 1 +
>>> proxy/logging/LogAccessICP.cc | 13 +++++++++++++
>>> proxy/logging/LogAccessICP.h | 3 ++-
>>> 9 files changed, 53 insertions(+), 1 deletion(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPConfig.cc
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
>>> index 01523f2..3e19557 100644
>>> --- a/proxy/ICPConfig.cc
>>> +++ b/proxy/ICPConfig.cc
>>> @@ -1301,6 +1301,12 @@ ICPlog::GetClientIP()
>>> return &_s->_sender.sa;
>>> }
>>>
>>> +in_port_t
>>> +ICPlog::GetClientPort()
>>> +{
>>> + return _s->_sender.port();
>>> +}
>>> +
>>> SquidLogCode ICPlog::GetAction()
>>> {
>>> if (_s->_queryResult == CACHE_EVENT_LOOKUP)
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPlog.h
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/ICPlog.h b/proxy/ICPlog.h
>>> index a5e01d9..f7f37e9 100644
>>> --- a/proxy/ICPlog.h
>>> +++ b/proxy/ICPlog.h
>>> @@ -52,6 +52,7 @@ public:
>>> }
>>> ink_hrtime GetElapsedTime();
>>> sockaddr const* GetClientIP();
>>> + in_port_t GetClientPort();
>>> SquidLogCode GetAction();
>>> const char *GetCode();
>>> int GetSize();
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/Log.cc
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
>>> index 546f83f..6a64ce7 100644
>>> --- a/proxy/logging/Log.cc
>>> +++ b/proxy/logging/Log.cc
>>> @@ -346,6 +346,13 @@ Log::init_fields()
>>> global_field_l
>
>
>
> --
> Yunkai Zhang
> Work at Taobao
Re: git commit: Add a new field: '%',
"client_host_port" to LogFormat
Posted by James Peach <jp...@apache.org>.
On Nov 20, 2013, at 9:58 AM, Yunkai Zhang <yu...@gmail.com> wrote:
> I wonder it's a small patch, maybe needn't a ticket.
>
> I'm pleasure to create one for it if necessary.
Yes please :)
>
> 在 2013年11月21日星期四,James Peach 写道:
>
>> What JIRA ticket is this?
>>
>> On Nov 20, 2013, at 6:27 AM, yunkai@apache.org wrote:
>>
>>> Updated Branches:
>>> refs/heads/master 938fa1ec2 -> ed8f6e9b0
>>>
>>>
>>> Add a new field: '%<chp>', "client_host_port" to LogFormat
>>>
>>> Signed-off-by: Yunkai Zhang <qi...@taobao.com>
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
>>> Commit:
>> http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ed8f6e9b
>>> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ed8f6e9b
>>> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ed8f6e9b
>>>
>>> Branch: refs/heads/master
>>> Commit: ed8f6e9b02170f311992dc5f00f9838b88ec7077
>>> Parents: 938fa1e
>>> Author: Yunkai Zhang <qi...@taobao.com>
>>> Authored: Wed Nov 20 17:45:08 2013 +0800
>>> Committer: Yunkai Zhang <qi...@taobao.com>
>>> Committed: Wed Nov 20 22:27:06 2013 +0800
>>>
>>> ----------------------------------------------------------------------
>>> proxy/ICPConfig.cc | 6 ++++++
>>> proxy/ICPlog.h | 1 +
>>> proxy/logging/Log.cc | 7 +++++++
>>> proxy/logging/LogAccess.cc | 9 +++++++++
>>> proxy/logging/LogAccess.h | 1 +
>>> proxy/logging/LogAccessHttp.cc | 13 +++++++++++++
>>> proxy/logging/LogAccessHttp.h | 1 +
>>> proxy/logging/LogAccessICP.cc | 13 +++++++++++++
>>> proxy/logging/LogAccessICP.h | 3 ++-
>>> 9 files changed, 53 insertions(+), 1 deletion(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPConfig.cc
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
>>> index 01523f2..3e19557 100644
>>> --- a/proxy/ICPConfig.cc
>>> +++ b/proxy/ICPConfig.cc
>>> @@ -1301,6 +1301,12 @@ ICPlog::GetClientIP()
>>> return &_s->_sender.sa;
>>> }
>>>
>>> +in_port_t
>>> +ICPlog::GetClientPort()
>>> +{
>>> + return _s->_sender.port();
>>> +}
>>> +
>>> SquidLogCode ICPlog::GetAction()
>>> {
>>> if (_s->_queryResult == CACHE_EVENT_LOOKUP)
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPlog.h
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/ICPlog.h b/proxy/ICPlog.h
>>> index a5e01d9..f7f37e9 100644
>>> --- a/proxy/ICPlog.h
>>> +++ b/proxy/ICPlog.h
>>> @@ -52,6 +52,7 @@ public:
>>> }
>>> ink_hrtime GetElapsedTime();
>>> sockaddr const* GetClientIP();
>>> + in_port_t GetClientPort();
>>> SquidLogCode GetAction();
>>> const char *GetCode();
>>> int GetSize();
>>>
>>>
>> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/Log.cc
>>> ----------------------------------------------------------------------
>>> diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
>>> index 546f83f..6a64ce7 100644
>>> --- a/proxy/logging/Log.cc
>>> +++ b/proxy/logging/Log.cc
>>> @@ -346,6 +346,13 @@ Log::init_fields()
>>> global_field_l
>
>
>
> --
> Yunkai Zhang
> Work at Taobao
Re: git commit: Add a new field: '%', "client_host_port" to LogFormat
Posted by Yunkai Zhang <yu...@gmail.com>.
I wonder it's a small patch, maybe needn't a ticket.
I'm pleasure to create one for it if necessary.
在 2013年11月21日星期四,James Peach 写道:
> What JIRA ticket is this?
>
> On Nov 20, 2013, at 6:27 AM, yunkai@apache.org wrote:
>
> > Updated Branches:
> > refs/heads/master 938fa1ec2 -> ed8f6e9b0
> >
> >
> > Add a new field: '%<chp>', "client_host_port" to LogFormat
> >
> > Signed-off-by: Yunkai Zhang <qi...@taobao.com>
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> > Commit:
> http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ed8f6e9b
> > Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ed8f6e9b
> > Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ed8f6e9b
> >
> > Branch: refs/heads/master
> > Commit: ed8f6e9b02170f311992dc5f00f9838b88ec7077
> > Parents: 938fa1e
> > Author: Yunkai Zhang <qi...@taobao.com>
> > Authored: Wed Nov 20 17:45:08 2013 +0800
> > Committer: Yunkai Zhang <qi...@taobao.com>
> > Committed: Wed Nov 20 22:27:06 2013 +0800
> >
> > ----------------------------------------------------------------------
> > proxy/ICPConfig.cc | 6 ++++++
> > proxy/ICPlog.h | 1 +
> > proxy/logging/Log.cc | 7 +++++++
> > proxy/logging/LogAccess.cc | 9 +++++++++
> > proxy/logging/LogAccess.h | 1 +
> > proxy/logging/LogAccessHttp.cc | 13 +++++++++++++
> > proxy/logging/LogAccessHttp.h | 1 +
> > proxy/logging/LogAccessICP.cc | 13 +++++++++++++
> > proxy/logging/LogAccessICP.h | 3 ++-
> > 9 files changed, 53 insertions(+), 1 deletion(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPConfig.cc
> > ----------------------------------------------------------------------
> > diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
> > index 01523f2..3e19557 100644
> > --- a/proxy/ICPConfig.cc
> > +++ b/proxy/ICPConfig.cc
> > @@ -1301,6 +1301,12 @@ ICPlog::GetClientIP()
> > return &_s->_sender.sa;
> > }
> >
> > +in_port_t
> > +ICPlog::GetClientPort()
> > +{
> > + return _s->_sender.port();
> > +}
> > +
> > SquidLogCode ICPlog::GetAction()
> > {
> > if (_s->_queryResult == CACHE_EVENT_LOOKUP)
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/ICPlog.h
> > ----------------------------------------------------------------------
> > diff --git a/proxy/ICPlog.h b/proxy/ICPlog.h
> > index a5e01d9..f7f37e9 100644
> > --- a/proxy/ICPlog.h
> > +++ b/proxy/ICPlog.h
> > @@ -52,6 +52,7 @@ public:
> > }
> > ink_hrtime GetElapsedTime();
> > sockaddr const* GetClientIP();
> > + in_port_t GetClientPort();
> > SquidLogCode GetAction();
> > const char *GetCode();
> > int GetSize();
> >
> >
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ed8f6e9b/proxy/logging/Log.cc
> > ----------------------------------------------------------------------
> > diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
> > index 546f83f..6a64ce7 100644
> > --- a/proxy/logging/Log.cc
> > +++ b/proxy/logging/Log.cc
> > @@ -346,6 +346,13 @@ Log::init_fields()
> > global_field_l
--
Yunkai Zhang
Work at Taobao