Skip to content

Commit

Permalink
HPCC-30295 Code review 2
Browse files Browse the repository at this point in the history
- Report error if invalid log message col detected

Signed-off-by: Rodrigo Pastrana <[email protected]>
  • Loading branch information
rpastrana committed Oct 4, 2023
1 parent ccec89e commit 50bf568
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ bool generateHPCCLogColumnstAllColumns(StringBuffer & kql, const char * colName,
}

StringBuffer sourceCol;
if (strcmp(colName, "LogMessage")==0)
if (targetsV2 && strcmp(colName, "LogMessage")==0)
sourceCol.set("tostring(LogMessage)");
else
else if (!targetsV2 && strcmp(colName, "LogEntry")==0)
sourceCol.append(colName);
else
throw makeStringExceptionV(-1, "%s: Invalid Azure Log Analytics log message column name detected: '%s'. Review logAccess configuration.", COMPONENT_NAME, colName);

kql.appendf("\n| extend hpcclogfields = extract_all(@\'^([0-9A-Fa-f]+)\\s+(OPR|USR|PRG|AUD|UNK)\\s+(DIS|ERR|WRN|INF|PRO|MET|UNK)\\s+(\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}\\.\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(UNK|[A-Z]\\d{8}-\\d{6}(?:-\\d+)?)\\s+\\\"(.*)\\\"$', %s)[0]", sourceCol.str());
kql.appendf("\n| extend %s = tostring(hpcclogfields.[0])", defaultHPCCLogSeqCol);
Expand Down

0 comments on commit 50bf568

Please sign in to comment.