Skip to content

Commit

Permalink
do not send fields if empty (#817)
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Dec 1, 2023
1 parent 49bfd10 commit 2adc10e
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions public/store/CorrelationsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,27 @@ export class CorrelationsStore implements ICorrelationsStore {
const response = await this.invalidateCache().service.createCorrelationRule({
name: correlationRule.name,
time_window: correlationRule.time_window,
correlate: correlationRule.queries?.map((query) => ({
index: query.index,
category: query.logType,
query: query.conditions
correlate: correlationRule.queries?.map((query) => {
const queryString = query.conditions
.map((condition) => `${condition.name}:${condition.value}`)
// TODO: for the phase one only AND condition is supported, add condition once the correlation engine support is implemented
.join(' AND '),
field: query.field,
})),
.join(' AND ');

const correlationInput: any = {
index: query.index,
category: query.logType,
};

if (queryString) {
correlationInput['query'] = queryString;
}

if (query.field) {
correlationInput['field'] = query.field;
}

return correlationInput;
}),
});

if (!response.ok) {
Expand Down

0 comments on commit 2adc10e

Please sign in to comment.