Skip to content

Commit

Permalink
TS-5051 Add a new log tag %<vbn> AppVersionInfo.BldNumStr
Browse files Browse the repository at this point in the history
  • Loading branch information
sekimura committed Nov 18, 2016
1 parent eac31a4 commit ead9d56
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
5 changes: 5 additions & 0 deletions proxy/logging/Log.cc
Expand Up @@ -838,6 +838,11 @@ Log::init_fields()
global_field_list.add(field, false);
ink_hash_table_insert(field_symbol_hash, "fsiz", 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);
ink_hash_table_insert(field_symbol_hash, "vbn", field);

Ptr<LogFieldAliasTable> entry_type_map = make_ptr(new LogFieldAliasTable);
entry_type_map->init(N_LOG_ENTRY_TYPES, LOG_ENTRY_HTTP, "LOG_ENTRY_HTTP", LOG_ENTRY_ICP, "LOG_ENTRY_ICP");
field = new LogField("log_entry_type", "etype", LogField::sINT, &LogAccess::marshal_entry_type, &LogAccess::unmarshal_entry_type,
Expand Down
10 changes: 10 additions & 0 deletions proxy/logging/LogAccess.cc
Expand Up @@ -765,6 +765,16 @@ LogAccess::marshal_ip(char *dest, sockaddr const *ip)
return INK_ALIGN_DEFAULT(len);
}

int
LogAccess::marshal_version_build_number(char *buf)
{
int len = sizeof(appVersionInfo.BldNumStr);
if (buf) {
marshal_str(buf, appVersionInfo.BldNumStr, len);
}
return len;
}

inline int
LogAccess::unmarshal_with_map(int64_t code, char *dest, int len, Ptr<LogFieldAliasMap> map, const char *msg)
{
Expand Down
13 changes: 7 additions & 6 deletions proxy/logging/LogAccess.h
Expand Up @@ -268,12 +268,13 @@ class LogAccess

// 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_process_uuid(char *); // STR
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
inkcoreapi virtual int marshal_version_build_number(char *); // STR

// These two are special, in that they are shared for all log types / implementations
inkcoreapi int marshal_entry_type(char *); // INT
Expand Down

0 comments on commit ead9d56

Please sign in to comment.