Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(comms): GetLogs use WsLogaccess.LogAccessType for filters #4213

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading