Skip to content

Commit

Permalink
Merge pull request #17839 from ghalliday/issue30393
Browse files Browse the repository at this point in the history
HPCC-30393 Add new event class and monitor audience

Reviewed-By: Rodrigo Pastrana <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Oct 6, 2023
2 parents c28b5db + 05a382f commit aa0dacf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions esp/scm/ws_logaccess.ecm
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ ESPenum LogAccessFilterOperator : int
* INF - Information
* PRO - Progress
* MET - Metric
* EVT - Event
*
*If searching by "ByTargetAudience", the SearchByValue should contain the 3 letter code associated with the target audience of interest.
* valid values at time of writing are:
* OPR - Operator
* USR - User
* PRO - Programmer
* MON - Monitor
* ADT - Audit
*If searching by "BySourceInstance", the SearchByValue should contain the instance of interest
*If searching by "BySourceNode", the SearchByValue should contain the node of interest
Expand Down
4 changes: 2 additions & 2 deletions helm/examples/logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ The logs can be filtered by TargetAudience, Category or Detail Level, and the ou

### Target Audience Filtering

The availble target audiences include operator(OPR), user(USR), programmer(PRO), audit(ADT), or all. The filter is controlled by the
The availble target audiences include operator(OPR), user(USR), programmer(PRO), monitor(MON), audit(ADT), or all. The filter is controlled by the
`<section>`.logging.audiences value. The string value is comprised of 3 letter codes delimited by the aggregation operator (+) or the removal operator (-).

For example, all component log output to include Programmer and User messages only:
helm install myhpcc ./hpcc --set global.logging.audiences="PRO+USR"

### Target Category Filtering

The available target categories include disaster(DIS), error(ERR), warning(WRN),information(INF),progress(PRO),metrics(MET). The category (or class) filter is controlled by the `<section>`.logging.classes value, comprised of 3 letter codes delimited by the aggregation operator (+) or the removal operator (-).
The available target categories include disaster(DIS), error(ERR), warning(WRN),information(INF),progress(PRO),metrics(MET),event(EVT). The category (or class) filter is controlled by the `<section>`.logging.classes value, comprised of 3 letter codes delimited by the aggregation operator (+) or the removal operator (-).

For example, the mydali instance's log output to include all classes except for progress:
helm install myhpcc ./hpcc --set dali[0].logging.classes="ALL-PRO" --set dali[0].name="mydali"
Expand Down
3 changes: 3 additions & 0 deletions system/jlib/jexcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
15 changes: 14 additions & 1 deletion system/jlib/jlog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: *
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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");
}
Expand All @@ -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");
}
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion system/jlib/jscm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa0dacf

Please sign in to comment.