You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/06/11 06:46:54 UTC

[1/2] trafficserver git commit: TS-3524 Add a new log tag, %, which is the cache lookup URL (key)

Repository: trafficserver
Updated Branches:
  refs/heads/master 983e0803e -> f9ead0b0b


TS-3524 Add a new log tag, %<cluc>, which is the cache lookup URL (key)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/719d55b6
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/719d55b6
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/719d55b6

Branch: refs/heads/master
Commit: 719d55b67da2fc80a4ac77860085c4e595d3326c
Parents: 983e080
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Apr 29 20:29:08 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Jun 10 22:32:51 2015 -0600

----------------------------------------------------------------------
 proxy/logging/Log.cc           |  5 +++++
 proxy/logging/LogAccess.cc     |  7 +++++++
 proxy/logging/LogAccess.h      | 13 ++++++------
 proxy/logging/LogAccessHttp.cc | 40 ++++++++++++++++++++++++++++++++++++-
 proxy/logging/LogAccessHttp.h  | 15 +++++++++-----
 5 files changed, 68 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/719d55b6/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index cfd83d1..4fe4706 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -439,6 +439,11 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "cqhl", field);
 
+  field = new LogField("cache_lookup_url_canonical", "cluc", LogField::STRING, &LogAccess::marshal_cache_lookup_url_canon,
+                       (LogField::UnmarshalFunc) & LogAccess::unmarshal_str);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "cluc", field);
+
   field = new LogField("client_req_body_len", "cqbl", LogField::sINT, &LogAccess::marshal_client_req_body_len,
                        &LogAccess::unmarshal_int_to_str);
   global_field_list.add(field, false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/719d55b6/proxy/logging/LogAccess.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index ce9afa1..bd2aacb 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -94,7 +94,14 @@ LogAccess::marshal_client_host_ip(char *buf)
 
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
+int
+LogAccess::marshal_cache_lookup_url_canon(char *buf)
+{
+  DEFAULT_STR_FIELD;
+}
 
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
 int
 LogAccess::marshal_client_host_port(char *buf)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/719d55b6/proxy/logging/LogAccess.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 77b5557..b8fdd2d 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -252,12 +252,13 @@ public:
 
   // other fields
   //
-  inkcoreapi virtual int marshal_transfer_time_ms(char *);    // INT
-  inkcoreapi virtual int marshal_transfer_time_s(char *);     // INT
-  inkcoreapi virtual int marshal_file_size(char *);           // INT
-  inkcoreapi virtual int marshal_plugin_identity_id(char *);  // INT
-  inkcoreapi virtual int marshal_plugin_identity_tag(char *); // STR
-  int marshal_entry_type(char *);                             // INT
+  inkcoreapi virtual int marshal_transfer_time_ms(char *);       // INT
+  inkcoreapi virtual int marshal_transfer_time_s(char *);        // INT
+  inkcoreapi virtual int marshal_file_size(char *);              // INT
+  inkcoreapi virtual int marshal_plugin_identity_id(char *);     // INT
+  inkcoreapi virtual int marshal_plugin_identity_tag(char *);    // STR
+  inkcoreapi virtual int marshal_cache_lookup_url_canon(char *); // STR
+  int marshal_entry_type(char *);                                // INT
 
 
   // named fields from within a http header

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/719d55b6/proxy/logging/LogAccessHttp.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index 438f48c..a0a5689 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -54,7 +54,8 @@ LogAccessHttp::LogAccessHttp(HttpSM *sm)
     m_client_req_url_canon_len(0), m_client_req_unmapped_url_canon_str(NULL), m_client_req_unmapped_url_canon_len(-1),
     m_client_req_unmapped_url_path_str(NULL), m_client_req_unmapped_url_path_len(-1), m_client_req_unmapped_url_host_str(NULL),
     m_client_req_unmapped_url_host_len(-1), m_client_req_url_path_str(NULL), m_client_req_url_path_len(0),
-    m_proxy_resp_content_type_str(NULL), m_proxy_resp_content_type_len(0)
+    m_proxy_resp_content_type_str(NULL), m_proxy_resp_content_type_len(0), m_cache_lookup_url_canon_str(NULL),
+    m_cache_lookup_url_canon_len(0)
 {
   ink_assert(m_http_sm != NULL);
 }
@@ -238,6 +239,22 @@ LogAccessHttp::marshal_client_host_ip(char *buf)
 
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
+int
+LogAccessHttp::marshal_cache_lookup_url_canon(char *buf)
+{
+  int len = INK_MIN_ALIGN;
+
+  validate_lookup_url();
+  len = round_strlen(m_cache_lookup_url_canon_len + 1); // +1 for eos
+  if (buf) {
+    marshal_mem(buf, m_cache_lookup_url_canon_str, m_cache_lookup_url_canon_len, len);
+  }
+
+  return len;
+}
+
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
 
 int
 LogAccessHttp::marshal_client_host_port(char *buf)
@@ -334,6 +351,27 @@ LogAccessHttp::validate_unmapped_url_path(void)
 
 
 /*-------------------------------------------------------------------------
+  Private utility function to validate m_cache_lookup_url_canon_str &
+  m_cache_lookup__url_canon_len fields.
+  -------------------------------------------------------------------------*/
+void
+LogAccessHttp::validate_lookup_url(void)
+{
+  if (m_cache_lookup_url_canon_len < 0) {
+    if (m_http_sm->t_state.cache_info.lookup_url_storage.valid()) {
+      int lookup_url_len;
+      char *lookup_url = m_http_sm->t_state.cache_info.lookup_url_storage.string_get_ref(&lookup_url_len);
+
+      if (lookup_url && lookup_url[0] != 0) {
+        m_cache_lookup_url_canon_str = LogUtils::escapify_url(&m_arena, lookup_url, lookup_url_len, &m_cache_lookup_url_canon_len);
+      }
+    } else {
+      m_cache_lookup_url_canon_len = 0;
+    }
+  }
+}
+
+/*-------------------------------------------------------------------------
   This is the method, url, and version all rolled into one.  Use the
   respective marshalling routines to do the job.
   -------------------------------------------------------------------------*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/719d55b6/proxy/logging/LogAccessHttp.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
index 04fbbc9..93731b8 100644
--- a/proxy/logging/LogAccessHttp.h
+++ b/proxy/logging/LogAccessHttp.h
@@ -128,11 +128,12 @@ public:
   //
   // other fields
   //
-  virtual int marshal_transfer_time_ms(char *);    // INT
-  virtual int marshal_transfer_time_s(char *);     // INT
-  virtual int marshal_file_size(char *);           // INT
-  virtual int marshal_plugin_identity_id(char *);  // INT
-  virtual int marshal_plugin_identity_tag(char *); // STR
+  virtual int marshal_transfer_time_ms(char *);       // INT
+  virtual int marshal_transfer_time_s(char *);        // INT
+  virtual int marshal_file_size(char *);              // INT
+  virtual int marshal_plugin_identity_id(char *);     // INT
+  virtual int marshal_plugin_identity_tag(char *);    // STR
+  virtual int marshal_cache_lookup_url_canon(char *); // STR
 
   //
   // named fields from within a http header
@@ -173,10 +174,14 @@ private:
   int m_client_req_url_path_len;
   char *m_proxy_resp_content_type_str;
   int m_proxy_resp_content_type_len;
+  char *m_cache_lookup_url_canon_str;
+  int m_cache_lookup_url_canon_len;
 
   void validate_unmapped_url(void);
   void validate_unmapped_url_path(void);
 
+  void validate_lookup_url(void);
+
   // -- member functions that are not allowed --
   LogAccessHttp(const LogAccessHttp &rhs);
   LogAccessHttp &operator=(LogAccessHttp &rhs);


[2/2] trafficserver git commit: Added TS-3524 to CHANGES, and update docs.

Posted by zw...@apache.org.
Added TS-3524 to CHANGES, and update docs.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f9ead0b0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f9ead0b0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f9ead0b0

Branch: refs/heads/master
Commit: f9ead0b0b6a21a42c6edb79912afbc520f620c24
Parents: 719d55b
Author: Leif Hedstrom <zw...@apache.org>
Authored: Wed Jun 10 22:17:33 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Jun 10 22:33:05 2015 -0600

----------------------------------------------------------------------
 CHANGES                                | 3 +++
 doc/admin/event-logging-formats.en.rst | 6 ++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f9ead0b0/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7835863..a3bb3b7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3524] Add a new log tag, %<cluc>, which is the cache lookup URL
+   (cache key).
+
   *) [TS-3542] Remove the reclaimable freelist feature, it will be replaced
    with a buddy allocation scheme.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f9ead0b0/doc/admin/event-logging-formats.en.rst
----------------------------------------------------------------------
diff --git a/doc/admin/event-logging-formats.en.rst b/doc/admin/event-logging-formats.en.rst
index c538fc7..4e1c7cc 100644
--- a/doc/admin/event-logging-formats.en.rst
+++ b/doc/admin/event-logging-formats.en.rst
@@ -235,6 +235,12 @@ The following list describes Traffic Server custom logging fields.
     The client request unmapped URL host. This field records a URL's
     host before it is remapped (reverse proxy mode).
 
+.. _cluc:
+
+``cluc``
+    The cache lookup URL, or cache key, for the client request. This URL is
+    canonicalized as well.
+
 .. _crat:
 
 ``crat``