Skip to content

Commit

Permalink
Merge pull request #4213 from jeclrsg/GetLogs-use-WsLogaccess.LogAcce…
Browse files Browse the repository at this point in the history
…ssType

fix(comms): GetLogs use WsLogaccess.LogAccessType for filters
  • Loading branch information
GordonSmith authored Jul 23, 2024
2 parents 439240f + 498ffa6 commit 33889e4
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions packages/comms/src/services/wsLogaccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,57 @@ export class LogaccessService extends LogaccessServiceBase {
for (const key in request) {
let searchField;
if (key in columnMap) {
searchField = columnMap[key];
if (Object.values(WsLogaccess.LogColumnType).includes(key as WsLogaccess.LogColumnType)) {
searchField = key;
} else {
searchField = columnMap[key];
}
}
let logCategory = WsLogaccess.LogAccessType.ByFieldName;
let logCategory;
if (searchField) {
switch (searchField) {
case WsLogaccess.LogColumnType.workunits:
case "hpcc.log.jobid":
logCategory = WsLogaccess.LogAccessType.ByJobID;
break;
case WsLogaccess.LogColumnType.audience:
case "hpcc.log.audience":
logCategory = WsLogaccess.LogAccessType.ByTargetAudience;
break;
case WsLogaccess.LogColumnType.class:
case "hpcc.log.class":
logCategory = WsLogaccess.LogAccessType.ByLogType;
break;
case WsLogaccess.LogColumnType.components:
case "kubernetes.container.name":
logCategory = WsLogaccess.LogAccessType.ByComponent;
break;
default:
logCategory = WsLogaccess.LogAccessType.ByFieldName;
searchField = columnMap[key];
}
if (Array.isArray(request[key])) {
request[key].forEach(value => {
if (logCategory === WsLogaccess.LogAccessType.ByComponent) {
value += "*";
}
filters.push({
LogCategory: logCategory,
SearchField: searchField,
SearchByValue: value
});
});
} else {
let value = request[key];
if (logCategory === WsLogaccess.LogAccessType.ByComponent) {
// append wildcard to end of search value to include ephemeral
// containers that aren't listed in ECL Watch's filters
value += "*";
}
filters.push({
LogCategory: logCategory,
SearchField: searchField,
SearchByValue: request[key]
SearchByValue: value
});
}
}
Expand Down

0 comments on commit 33889e4

Please sign in to comment.