Skip to content

Commit d997be7

Browse files
authored
[SIEM] [Detection Engine] Fixes histogram intervals (#55969) (#56086)
## Summary This PR wraps up the remaining `Detection Engine` meta tickets: #55585, #54935, and elastic/siem-team#498 - [x] Histogram bar interval (bar counts and widths) consistency (#55585) - [x] Make the bar intervals a consistent 32 bars across the board * Enabled `extended_bounds`, `min_doc_count: 0`, and now setting consistent `fixed_interval` when querying to ensure the entire daterange is displayed across all histograms. - [x] Filter out the "untitled" timelines from both timeline selection options during rule creation (elastic/siem-team#498) - [ ] ~Import query from saved timeline~ * For 7.7 tracking ticket here: #56079 - [x] `Investigate detections using this timeline template` - [x] Everywhere we use "Alerts" (Overview page, Host Tab, Network Tab) we should change the term to "External Alerts" - [x] Updated Host Page Tab/Table/Histogram/Breadcrumbs - [x] Updated Network Page Tab/Table/Histogram/Breadcrumbs - [x] Updated DE permission/index error doc links to go to [corresponding DE docs section](https://www.elastic.co/guide/en/siem/guide/7.6/detection-engine-overview.html#detections-permissions) - [x] Removed `frequency` in favor of `count` for remaining histograms ##### Inconsistent Histogram intervals ![image](https://user-images.githubusercontent.com/2946766/73161560-04a82300-40a9-11ea-950f-ea56f9a5bfd7.png) ##### Consistent Histogram Intervals ![image](https://user-images.githubusercontent.com/2946766/73159564-fefc0e80-40a3-11ea-9b9d-4d15899dabd2.png) cc @MichaelMarcialis @cwurm @MikePaquette ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. - [ ] ~This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~ - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md) - [ ] ~[Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~ - [ ] ~[Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~ - [ ] ~This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~ ### For maintainers - [ ] ~This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~ - [ ] ~This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
1 parent ea2983e commit d997be7

File tree

17 files changed

+118
-104
lines changed

17 files changed

+118
-104
lines changed

x-pack/legacy/plugins/siem/public/components/alerts_viewer/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
import { noop } from 'lodash/fp';
77
import React, { useEffect, useCallback } from 'react';
88
import { EuiSpacer } from '@elastic/eui';
9+
import numeral from '@elastic/numeral';
910

1011
import { AlertsComponentsQueryProps } from './types';
1112
import { AlertsTable } from './alerts_table';
1213
import * as i18n from './translations';
1314
import { MatrixHistogramOption } from '../matrix_histogram/types';
1415
import { MatrixHistogramContainer } from '../../containers/matrix_histogram';
1516
import { MatrixHistogramGqlQuery } from '../../containers/matrix_histogram/index.gql_query';
17+
import { useUiSetting$ } from '../../lib/kibana';
18+
import { DEFAULT_NUMBER_FORMAT } from '../../../common/constants';
1619
const ID = 'alertsOverTimeQuery';
1720
export const alertsStackByOptions: MatrixHistogramOption[] = [
1821
{
@@ -37,6 +40,8 @@ export const AlertsView = ({
3740
type,
3841
updateDateRange = noop,
3942
}: AlertsComponentsQueryProps) => {
43+
const [defaultNumberFormat] = useUiSetting$<string>(DEFAULT_NUMBER_FORMAT);
44+
4045
useEffect(() => {
4146
return () => {
4247
if (deleteQuery) {
@@ -46,7 +51,10 @@ export const AlertsView = ({
4651
}, []);
4752

4853
const getSubtitle = useCallback(
49-
(totalCount: number) => `${i18n.SHOWING}: ${totalCount} ${i18n.UNIT(totalCount)}`,
54+
(totalCount: number) =>
55+
`${i18n.SHOWING}: ${numeral(totalCount).format(defaultNumberFormat)} ${i18n.UNIT(
56+
totalCount
57+
)}`,
5058
[]
5159
);
5260

x-pack/legacy/plugins/siem/public/components/alerts_viewer/translations.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
import { i18n } from '@kbn/i18n';
88

99
export const ALERTS_DOCUMENT_TYPE = i18n.translate('xpack.siem.alertsView.alertsDocumentType', {
10-
defaultMessage: 'Alerts',
10+
defaultMessage: 'External alerts',
1111
});
1212

1313
export const TOTAL_COUNT_OF_ALERTS = i18n.translate('xpack.siem.alertsView.totalCountOfAlerts', {
14-
defaultMessage: 'alerts match the search criteria',
14+
defaultMessage: 'external alerts match the search criteria',
1515
});
1616

1717
export const ALERTS_TABLE_TITLE = i18n.translate('xpack.siem.alertsView.alertsTableTitle', {
18-
defaultMessage: 'Alerts',
18+
defaultMessage: 'External alerts',
1919
});
2020

2121
export const ALERTS_GRAPH_TITLE = i18n.translate('xpack.siem.alertsView.alertsGraphTitle', {
22-
defaultMessage: 'Alert detection frequency',
22+
defaultMessage: 'External alerts count',
2323
});
2424

2525
export const ALERTS_STACK_BY_MODULE = i18n.translate(
@@ -36,7 +36,7 @@ export const SHOWING = i18n.translate('xpack.siem.alertsView.showing', {
3636
export const UNIT = (totalCount: number) =>
3737
i18n.translate('xpack.siem.alertsView.unit', {
3838
values: { totalCount },
39-
defaultMessage: `{totalCount, plural, =1 {alert} other {alerts}}`,
39+
defaultMessage: `external {totalCount, plural, =1 {alert} other {alerts}}`,
4040
});
4141

4242
export const ERROR_FETCHING_ALERTS_DATA = i18n.translate(

x-pack/legacy/plugins/siem/public/components/timeline/search_super_select/index.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const MyEuiFlexGroup = styled(EuiFlexGroup)`
7373

7474
interface SearchTimelineSuperSelectProps {
7575
isDisabled: boolean;
76+
hideUntitled?: boolean;
7677
timelineId: string | null;
7778
timelineTitle: string | null;
7879
onTimelineChange: (timelineTitle: string, timelineId: string | null) => void;
@@ -101,6 +102,7 @@ const POPOVER_HEIGHT = 260;
101102
const TIMELINE_ITEM_HEIGHT = 50;
102103
const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProps> = ({
103104
isDisabled,
105+
hideUntitled = false,
104106
timelineId,
105107
timelineTitle,
106108
onTimelineChange,
@@ -287,7 +289,11 @@ const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProp
287289
rowHeight: TIMELINE_ITEM_HEIGHT,
288290
showIcons: false,
289291
virtualizedProps: ({
290-
onScroll: handleOnScroll.bind(null, timelines.length, totalCount),
292+
onScroll: handleOnScroll.bind(
293+
null,
294+
timelines.filter(t => !hideUntitled || t.title !== '').length,
295+
totalCount
296+
),
291297
} as unknown) as ListProps,
292298
}}
293299
renderOption={renderTimelineOption}
@@ -308,18 +314,20 @@ const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProp
308314
...(!onlyFavorites && searchTimelineValue === ''
309315
? getBasicSelectableOptions(timelineId == null ? '-1' : timelineId)
310316
: []),
311-
...timelines.map(
312-
(t, index) =>
313-
({
314-
description: t.description,
315-
favorite: t.favorite,
316-
label: t.title,
317-
id: t.savedObjectId,
318-
key: `${t.title}-${index}`,
319-
title: t.title,
320-
checked: t.savedObjectId === timelineId ? 'on' : undefined,
321-
} as Option)
322-
),
317+
...timelines
318+
.filter(t => !hideUntitled || t.title !== '')
319+
.map(
320+
(t, index) =>
321+
({
322+
description: t.description,
323+
favorite: t.favorite,
324+
label: t.title,
325+
id: t.savedObjectId,
326+
key: `${t.title}-${index}`,
327+
title: t.title,
328+
checked: t.savedObjectId === timelineId ? 'on' : undefined,
329+
} as Option)
330+
),
323331
]}
324332
>
325333
{(list, search) => (

x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals_histogram_panel/helpers.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ export const getSignalsHistogramQuery = (
4747
},
4848
aggs: {
4949
signals: {
50-
auto_date_histogram: {
50+
date_histogram: {
5151
field: '@timestamp',
52-
buckets: 36,
52+
fixed_interval: `${Math.floor((to - from) / 32)}ms`,
53+
min_doc_count: 0,
54+
extended_bounds: {
55+
min: from,
56+
max: to,
57+
},
5358
},
5459
},
5560
},

x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals_histogram_panel/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const STACK_BY_USERS = i18n.translate(
8686
export const HISTOGRAM_HEADER = i18n.translate(
8787
'xpack.siem.detectionEngine.signals.histogram.headerTitle',
8888
{
89-
defaultMessage: 'Signal count',
89+
defaultMessage: 'Signals count',
9090
}
9191
);
9292

x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine_no_signal_index.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@
55
*/
66

77
import React from 'react';
8-
import chrome from 'ui/chrome';
98

109
import { EmptyPage } from '../../components/empty_page';
1110
import * as i18n from './translations';
11+
import { useKibana } from '../../lib/kibana';
1212

13-
const basePath = chrome.getBasePath();
14-
15-
export const DetectionEngineNoIndex = React.memo(() => (
16-
<EmptyPage
17-
actionPrimaryIcon="documents"
18-
actionPrimaryLabel={i18n.GO_TO_DOCUMENTATION}
19-
actionPrimaryUrl={`${basePath}/app/kibana#/home/tutorial_directory/siem`}
20-
actionPrimaryTarget="_blank"
21-
message={i18n.NO_INDEX_MSG_BODY}
22-
data-test-subj="no_index"
23-
title={i18n.NO_INDEX_TITLE}
24-
/>
25-
));
13+
export const DetectionEngineNoIndex = React.memo(() => {
14+
const docLinks = useKibana().services.docLinks;
15+
return (
16+
<EmptyPage
17+
actionPrimaryIcon="documents"
18+
actionPrimaryLabel={i18n.GO_TO_DOCUMENTATION}
19+
actionPrimaryUrl={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/siem/guide/${docLinks.DOC_LINK_VERSION}/detection-engine-overview.html#detections-permissions`}
20+
actionPrimaryTarget="_blank"
21+
message={i18n.NO_INDEX_MSG_BODY}
22+
data-test-subj="no_index"
23+
title={i18n.NO_INDEX_TITLE}
24+
/>
25+
);
26+
});
2627

2728
DetectionEngineNoIndex.displayName = 'DetectionEngineNoIndex';

x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine_user_unauthenticated.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,25 @@
55
*/
66

77
import React from 'react';
8-
import chrome from 'ui/chrome';
98

109
import { EmptyPage } from '../../components/empty_page';
1110
import * as i18n from './translations';
11+
import { useKibana } from '../../lib/kibana';
1212

13-
const basePath = chrome.getBasePath();
13+
export const DetectionEngineUserUnauthenticated = React.memo(() => {
14+
const docLinks = useKibana().services.docLinks;
1415

15-
export const DetectionEngineUserUnauthenticated = React.memo(() => (
16-
<EmptyPage
17-
actionPrimaryIcon="documents"
18-
actionPrimaryLabel={i18n.GO_TO_DOCUMENTATION}
19-
actionPrimaryUrl={`${basePath}/app/kibana#/home/tutorial_directory/siem`}
20-
actionPrimaryTarget="_blank"
21-
message={i18n.USER_UNAUTHENTICATED_MSG_BODY}
22-
data-test-subj="no_index"
23-
title={i18n.USER_UNAUTHENTICATED_TITLE}
24-
/>
25-
));
16+
return (
17+
<EmptyPage
18+
actionPrimaryIcon="documents"
19+
actionPrimaryLabel={i18n.GO_TO_DOCUMENTATION}
20+
actionPrimaryUrl={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/siem/guide/${docLinks.DOC_LINK_VERSION}/detection-engine-overview.html#detections-permissions`}
21+
actionPrimaryTarget="_blank"
22+
message={i18n.USER_UNAUTHENTICATED_MSG_BODY}
23+
data-test-subj="no_index"
24+
title={i18n.USER_UNAUTHENTICATED_TITLE}
25+
/>
26+
);
27+
});
2628

2729
DetectionEngineUserUnauthenticated.displayName = 'DetectionEngineUserUnauthenticated';

x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/components/pick_timeline/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const PickTimeline = ({
6565
>
6666
<SearchTimelineSuperSelect
6767
isDisabled={isDisabled}
68+
hideUntitled={true}
6869
timelineId={timelineId}
6970
timelineTitle={timelineTitle}
7071
onTimelineChange={handleOnTimelineChange}

x-pack/legacy/plugins/siem/public/pages/hosts/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const NAVIGATION_EVENTS_TITLE = i18n.translate('xpack.siem.hosts.navigati
4747
});
4848

4949
export const NAVIGATION_ALERTS_TITLE = i18n.translate('xpack.siem.hosts.navigation.alertsTitle', {
50-
defaultMessage: 'Alerts',
50+
defaultMessage: 'External alerts',
5151
});
5252

5353
export const ERROR_FETCHING_AUTHENTICATIONS_DATA = i18n.translate(

x-pack/legacy/plugins/siem/public/pages/network/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const NAVIGATION_ANOMALIES_TITLE = i18n.translate(
4545
);
4646

4747
export const NAVIGATION_ALERTS_TITLE = i18n.translate('xpack.siem.network.navigation.alertsTitle', {
48-
defaultMessage: 'Alerts',
48+
defaultMessage: 'External alerts',
4949
});
5050

5151
export const DOMAINS_COUNT_BY = (groupByField: string) =>

0 commit comments

Comments
 (0)