Skip to content

Commit 5728ccd

Browse files
authored
Merge pull request #78 from Flared/mahinse/fix_saved_searches
Saved searches should retrieve the last 24 hours instead of all time
2 parents 8e84972 + 6714c98 commit 5728ccd

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Flare Search]
2-
description = Shows all of the ingested events
3-
search = source="flare"
2+
description = Shows the ingested events from the last 24 hours
3+
search = source="flare index=flare earliest=-24h latest=now"
44

55
[Severity]
6-
description = Counts the events by severity
7-
search = source=flare index=main | spath path=header.risk.score output=risk_score_str | eval risk_score = coalesce(tonumber(risk_score_str), 0) | eval risk_label = case(risk_score == 1, "Info", risk_score == 2, "Low", risk_score == 3, "Medium", risk_score == 4, "High", risk_score == 5, "Critical") | stats count by risk_label, risk_score | sort risk_score | fields - risk_score
6+
description = Counts the events by severity in the last 24 hours
7+
search = source=flare index=flare earliest=-24h latest=now | spath path=header.risk.score output=risk_score_str | eval risk_score = coalesce(tonumber(risk_score_str), 0) | eval risk_label = case(risk_score == 1, "Info", risk_score == 2, "Low", risk_score == 3, "Medium", risk_score == 4, "High", risk_score == 5, "Critical") | stats count by risk_label, risk_score | sort risk_score | fields - risk_score

packages/react-components/src/models/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const APPLICATION_NAMESPACE: SplunkApplicationNamespace = {
88
sharing: 'app',
99
};
1010
export const FLARE_SAVED_SEARCH_NAME = 'Flare Search';
11+
export const SEVERITY_SAVED_SEARCH_NAME = 'Severity';
1112
export const KV_COLLECTION_NAME = 'event_ingestion_collection';
1213
export const KV_COLLECTION_KEY = '_key';
1314
export const KV_COLLECTION_VALUE = 'value';

packages/react-components/src/utils/setupConfiguration.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
KV_COLLECTION_NAME,
77
KV_COLLECTION_VALUE,
88
PasswordKeys,
9+
SEVERITY_SAVED_SEARCH_NAME,
910
STORAGE_REALM,
1011
} from '../models/constants';
1112
import { Severity, SourceType, SourceTypeCategory, Tenant } from '../models/flare';
@@ -154,7 +155,12 @@ async function saveConfiguration(
154155
await updateSavedSearchQuery(
155156
service,
156157
FLARE_SAVED_SEARCH_NAME,
157-
`source=${APP_NAME} index=${indexName}`
158+
`source=${APP_NAME} index=${indexName} earliest=-24h latest=now`
159+
);
160+
await updateSavedSearchQuery(
161+
service,
162+
SEVERITY_SAVED_SEARCH_NAME,
163+
`source=${APP_NAME} index=${indexName} earliest=-24h latest=now | spath path=header.risk.score output=risk_score_str | eval risk_score = coalesce(tonumber(risk_score_str), 0) | eval risk_label = case(risk_score == 1, "Info", risk_score == 2, "Low", risk_score == 3, "Medium", risk_score == 4, "High", risk_score == 5, "Critical") | stats count by risk_label, risk_score | sort risk_score | fields - risk_score`
158164
);
159165
await completeSetup(service);
160166
await reloadApp(service);

0 commit comments

Comments
 (0)