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 2016/07/02 16:30:02 UTC

[trafficserver] 02/03: TS-4519 Adds a new log tag, % for the process UUID

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit dda9df7ca7b886b5fd54d3ff6e9ed4f741948ba3
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Tue Jun 14 11:10:27 2016 -0600

    TS-4519 Adds a new log tag, %<puuid> for the process UUID
---
 proxy/logging/Log.cc           |  5 +++++
 proxy/logging/LogAccess.cc     | 15 +++++++++++++++
 proxy/logging/LogAccess.h      | 17 ++++++++++-------
 proxy/logging/LogAccessHttp.cc |  1 +
 4 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 1840d85..8cb21b4 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -476,6 +476,11 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "cluc", field);
 
+  field = new LogField("process_uuid", "puuid", LogField::STRING, &LogAccess::marshal_process_uuid,
+                       (LogField::UnmarshalFunc)&LogAccess::unmarshal_str);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "puuid", 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);
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index f3a47f6..d2d518b 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -96,6 +96,7 @@ LogAccess::marshal_host_interface_ip(char *buf)
 {
   DEFAULT_IP_FIELD;
 }
+
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 int
@@ -710,6 +711,20 @@ LogAccess::marshal_entry_type(char *buf)
 
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
+int
+LogAccess::marshal_process_uuid(char *buf)
+{
+  int len = round_strlen(TS_UUID_STRING_LEN + 1);
+
+  if (buf) {
+    const char *str = (char *)Machine::instance()->uuid.getString();
+    marshal_str(buf, str, len);
+  }
+  return len;
+}
+
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
 
 int
 LogAccess::marshal_config_int_var(char *config_var, char *buf)
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 3c8d226..c90b0df 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -263,13 +263,16 @@ 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
-  inkcoreapi virtual int marshal_cache_lookup_url_canon(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_process_uuid(char *);        // STR
+
+  // These two are special, in that they are shared for all log types / implementations
+  inkcoreapi int marshal_entry_type(char *);             // INT
+  inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR
 
   // named fields from within a http header
   //
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index ff462c5..beb9e48 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -756,6 +756,7 @@ LogAccessHttp::marshal_client_req_id(char *buf)
   }
   return INK_MIN_ALIGN;
 }
+
 /*-------------------------------------------------------------------------
 -------------------------------------------------------------------------*/
 int

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.