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 2020/04/08 23:31:57 UTC
[trafficserver] branch 9.0.x updated: Add a new log tag %
AppVersionInfo.BldNumStr
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 1ba3e68 Add a new log tag %<vbn> AppVersionInfo.BldNumStr
1ba3e68 is described below
commit 1ba3e68d16771a92876fc151fe430313729d7e5f
Author: Masa Sekimura <se...@gmail.com>
AuthorDate: Fri Nov 18 23:34:35 2016 +0000
Add a new log tag %<vbn> AppVersionInfo.BldNumStr
TS-5051
(cherry picked from commit 9bd8abb51984861801af03310869424db244b778)
---
proxy/http/unit_tests/unit_test_main.cc | 5 +++++
proxy/logging/Log.cc | 5 +++++
proxy/logging/LogAccess.cc | 15 +++++++++++++++
proxy/logging/LogAccess.h | 1 +
4 files changed, 26 insertions(+)
diff --git a/proxy/http/unit_tests/unit_test_main.cc b/proxy/http/unit_tests/unit_test_main.cc
index 6aed3a6..6217bda 100644
--- a/proxy/http/unit_tests/unit_test_main.cc
+++ b/proxy/http/unit_tests/unit_test_main.cc
@@ -22,4 +22,9 @@
*/
#define CATCH_CONFIG_MAIN
+
#include "catch.hpp"
+
+#include "tscore/I_Version.h"
+
+AppVersionInfo appVersionInfo;
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 9f39ea9..42f8dc3 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -902,6 +902,11 @@ Log::init_fields()
global_field_list.add(field, false);
field_symbol_hash.emplace("ctpd", field);
+ field = new LogField("version_build_number", "vbn", LogField::STRING, &LogAccess::marshal_version_build_number,
+ (LogField::UnmarshalFunc)&LogAccess::unmarshal_str);
+ global_field_list.add(field, false);
+ field_symbol_hash.emplace("vbn", field);
+
init_status |= FIELDS_INITIALIZED;
}
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index 6e3aac4..32b2e19 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -30,6 +30,8 @@
#include "LogFormat.h"
#include "LogBuffer.h"
+extern AppVersionInfo appVersionInfo;
+
char INVALID_STR[] = "!INVALID_STR!";
#define HIDDEN_CONTENT_TYPE "@Content-Type"
@@ -1300,6 +1302,19 @@ LogAccess::marshal_client_sni_server_name(char *buf)
-------------------------------------------------------------------------*/
int
+LogAccess::marshal_version_build_number(char *buf)
+{
+ int len = sizeof(appVersionInfo.BldNumStr);
+ if (buf) {
+ marshal_str(buf, appVersionInfo.BldNumStr, len);
+ }
+ return len;
+}
+
+/*-------------------------------------------------------------------------
+ -------------------------------------------------------------------------*/
+
+int
LogAccess::marshal_client_host_port(char *buf)
{
if (buf) {
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index fa83bc8..e9090d3 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -251,6 +251,7 @@ public:
inkcoreapi int marshal_client_http_transaction_priority_dependence(char *); // INT
inkcoreapi int marshal_cache_lookup_url_canon(char *); // STR
inkcoreapi int marshal_client_sni_server_name(char *); // STR
+ inkcoreapi int marshal_version_build_number(char *); // STR
// named fields from within a http header
//