Skip to content

Commit

Permalink
Saved searches should retrieve the last 24 hours instead of all time
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-Antoine Hinse committed Dec 9, 2024
1 parent 8e84972 commit 6714c98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Flare Search]
description = Shows all of the ingested events
search = source="flare"
description = Shows the ingested events from the last 24 hours
search = source="flare index=flare earliest=-24h latest=now"

[Severity]
description = Counts the events by severity
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
description = Counts the events by severity in the last 24 hours
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
1 change: 1 addition & 0 deletions packages/react-components/src/models/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const APPLICATION_NAMESPACE: SplunkApplicationNamespace = {
sharing: 'app',
};
export const FLARE_SAVED_SEARCH_NAME = 'Flare Search';
export const SEVERITY_SAVED_SEARCH_NAME = 'Severity';
export const KV_COLLECTION_NAME = 'event_ingestion_collection';
export const KV_COLLECTION_KEY = '_key';
export const KV_COLLECTION_VALUE = 'value';
Expand Down
8 changes: 7 additions & 1 deletion packages/react-components/src/utils/setupConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
KV_COLLECTION_NAME,
KV_COLLECTION_VALUE,
PasswordKeys,
SEVERITY_SAVED_SEARCH_NAME,
STORAGE_REALM,
} from '../models/constants';
import { Severity, SourceType, SourceTypeCategory, Tenant } from '../models/flare';
Expand Down Expand Up @@ -154,7 +155,12 @@ async function saveConfiguration(
await updateSavedSearchQuery(
service,
FLARE_SAVED_SEARCH_NAME,
`source=${APP_NAME} index=${indexName}`
`source=${APP_NAME} index=${indexName} earliest=-24h latest=now`
);
await updateSavedSearchQuery(
service,
SEVERITY_SAVED_SEARCH_NAME,
`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`
);
await completeSetup(service);
await reloadApp(service);
Expand Down

0 comments on commit 6714c98

Please sign in to comment.