From e3680737e92172d679a6515f9d1e2a2c107cb0fc Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Thu, 28 Sep 2023 14:44:12 +0100 Subject: [PATCH] HPCC-30393 Add new event class and monitor audience Signed-off-by: Gavin Halliday --- system/jlib/jexcept.cpp | 3 +++ system/jlib/jlog.hpp | 15 ++++++++++++++- system/jlib/jscm.hpp | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/system/jlib/jexcept.cpp b/system/jlib/jexcept.cpp index 1273588d799..7168d2d85a9 100644 --- a/system/jlib/jexcept.cpp +++ b/system/jlib/jexcept.cpp @@ -302,6 +302,7 @@ const char* serializeMessageAudience(MessageAudience ma) case MSGAUD_operator: ret = "operator"; break; case MSGAUD_user: ret = "user"; break; case MSGAUD_programmer: ret = "programmer"; break; + case MSGAUD_monitor: ret = "monitor"; break; case MSGAUD_all: ret = "all"; break; default: ret = "unknown"; break; } @@ -319,6 +320,8 @@ MessageAudience deserializeMessageAudience(const char* text) ma = MSGAUD_user; else if (!strcmp(text, "programmer")) ma = MSGAUD_programmer; + else if (!strcmp(text, "monitor")) + ma = MSGAUD_monitor; else if (!strcmp(text, "all")) ma = MSGAUD_all; } diff --git a/system/jlib/jlog.hpp b/system/jlib/jlog.hpp index 64cb242e49c..d69e9f5d07a 100644 --- a/system/jlib/jlog.hpp +++ b/system/jlib/jlog.hpp @@ -68,7 +68,8 @@ typedef enum MSGCLS_metric = 0x20, // A metric line MSGCLS_addid = 0x40, // Internal use within log system MSGCLS_removeid = 0x80, // Internal use within log system - MSGCLS_all = 0xFF // Use as a filter to select all messages + MSGCLS_event = 0x100, // A timestamp or event where the time it occurs is significant + MSGCLS_all = 0xFFFF // Use as a filter to select all messages } LogMsgClass; /* ------------------------------------------------------------------------------------ * * NOTES: * @@ -141,6 +142,8 @@ inline const char * LogMsgAudienceToVarString(LogMsgAudience audience) return("User"); case MSGAUD_programmer: return("Programmer"); + case MSGAUD_monitor: + return("Monitor"); case MSGAUD_audit: return("Audit"); default: @@ -158,6 +161,8 @@ inline const char * LogMsgAudienceToFixString(LogMsgAudience audience) return("USR"); case MSGAUD_programmer: return("PRG"); + case MSGAUD_monitor: + return("MON"); case MSGAUD_audit: return("AUD"); default: @@ -172,6 +177,8 @@ inline MessageAudience LogMsgAudFromAbbrev(char const * abbrev) return MSGAUD_user; if(strnicmp(abbrev, "PRO", 3)==0) return MSGAUD_programmer; + if(strnicmp(abbrev, "MON", 3)==0) + return MSGAUD_monitor; if(strnicmp(abbrev, "ADT", 3)==0) return MSGAUD_audit; if(strnicmp(abbrev, "ALL", 3)==0) @@ -195,6 +202,8 @@ inline const char * LogMsgClassToVarString(LogMsgClass msgClass) return("Progress"); case MSGCLS_metric: return("Metric"); + case MSGCLS_event: + return("Event"); default: return("UNKNOWN"); } @@ -216,6 +225,8 @@ inline const char * LogMsgClassToFixString(LogMsgClass msgClass) return("PRO"); case MSGCLS_metric: return("MET"); + case MSGCLS_event: + return("EVT"); default: return("UNK"); } @@ -235,6 +246,8 @@ inline LogMsgClass LogMsgClassFromAbbrev(char const * abbrev) return MSGCLS_progress; if(strnicmp(abbrev, "MET", 3)==0) return MSGCLS_metric; + if(strnicmp(abbrev, "EVT", 3)==0) + return MSGCLS_event; if(strnicmp(abbrev, "ALL", 3)==0) return MSGCLS_all; return MSGCLS_unknown; diff --git a/system/jlib/jscm.hpp b/system/jlib/jscm.hpp index 6a08dbdca92..718d6f3a215 100644 --- a/system/jlib/jscm.hpp +++ b/system/jlib/jscm.hpp @@ -310,7 +310,8 @@ typedef enum // would not be resolvable by sysadmin or ECL developers. Additional information that may // be useful for improving the platform. MSGAUD_programmer = 0x20, - // MSGAUD_legacy = 0x40, REMOVED - may be reused later + // Target audience: Automatic monitoring tools + MSGAUD_monitor = 0x40, // Target audience: persons involved in accounting and security audits MSGAUD_audit = 0x80, // MSGAUD_all is to be used for filtering or specifying which messages are to be logged