trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [trafficserver] branch master updated: Add a new log tag %<vs> (#8067)
Date Thu, 15 Jul 2021 16:56:05 GMT
This is an automated email from the ASF dual-hosted git repository.

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new bdc749e  Add a new log tag %<vs> (#8067)
bdc749e is described below

commit bdc749e140c2627b7a501ab05c4d81bf91cc78f6
Author: Randall Meyer <rrm@apache.org>
AuthorDate: Thu Jul 15 09:55:53 2021 -0700

    Add a new log tag %<vs> (#8067)
    
    This exposes a new log tag with the value of AppVersionInfo.VersionString
---
 proxy/logging/Log.cc       |  5 +++++
 proxy/logging/LogAccess.cc | 13 +++++++++++++
 proxy/logging/LogAccess.h  |  1 +
 3 files changed, 19 insertions(+)

diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index e4abd7f..1db5eb6 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -954,6 +954,11 @@ Log::init_fields()
   global_field_list.add(field, false);
   field_symbol_hash.emplace("vbn", field);
 
+  field = new LogField("version_string", "vs", LogField::STRING, &LogAccess::marshal_version_string,
+                       reinterpret_cast<LogField::UnmarshalFunc>(&LogAccess::unmarshal_str));
+  global_field_list.add(field, false);
+  field_symbol_hash.emplace("vs", field);
+
   init_status |= FIELDS_INITIALIZED;
 }
 
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index 8887d93..9a22c72 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -1353,6 +1353,19 @@ LogAccess::marshal_version_build_number(char *buf)
   -------------------------------------------------------------------------*/
 
 int
+LogAccess::marshal_version_string(char *buf)
+{
+  int len = LogAccess::strlen(appVersionInfo.VersionStr);
+  if (buf) {
+    marshal_str(buf, appVersionInfo.VersionStr, len);
+  }
+  return len;
+}
+
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
+
+int
 LogAccess::marshal_proxy_protocol_version(char *buf)
 {
   const char *version_str = nullptr;
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 389bedc..8eaaa62 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -256,6 +256,7 @@ public:
   inkcoreapi int marshal_client_provided_cert(char *);                        // INT
   inkcoreapi int marshal_proxy_provided_cert(char *);                         // INT
   inkcoreapi int marshal_version_build_number(char *);                        // STR
+  inkcoreapi int marshal_version_string(char *);                              // STR
   inkcoreapi int marshal_cache_read_retries(char *);                          // INT
   inkcoreapi int marshal_cache_write_retries(char *);                         // INT
   inkcoreapi int marshal_cache_collapsed_connection_success(char *);          // INT

Mime
View raw message