Skip to content

Commit 54220f6

Browse files
committed
Fixes histogram intervals and requested text cleanup
1 parent 2d3b569 commit 54220f6

File tree

11 files changed

+72
-69
lines changed

11 files changed

+72
-69
lines changed

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/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) =>

x-pack/legacy/plugins/siem/server/lib/alerts/query.dsl.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query';
7+
import { createQueryFilterClauses, calculateTimeSeriesInterval } from '../../utils/build_query';
88
import { buildTimelineQuery } from '../events/query.dsl';
99
import { RequestOptions, MatrixHistogramRequestOptions } from '../framework';
1010

@@ -68,18 +68,17 @@ export const buildAlertsHistogramQuery = ({
6868
];
6969

7070
const getHistogramAggregation = () => {
71-
const interval = calculateTimeseriesInterval(from, to);
71+
const interval = calculateTimeSeriesInterval(from, to);
7272
const histogramTimestampField = '@timestamp';
7373
const dateHistogram = {
7474
date_histogram: {
7575
field: histogramTimestampField,
76-
fixed_interval: `${interval}s`,
77-
},
78-
};
79-
const autoDateHistogram = {
80-
auto_date_histogram: {
81-
field: histogramTimestampField,
82-
buckets: 36,
76+
fixed_interval: interval,
77+
min_doc_count: 0,
78+
extended_bounds: {
79+
min: from,
80+
max: to,
81+
},
8382
},
8483
};
8584
return {
@@ -93,7 +92,7 @@ export const buildAlertsHistogramQuery = ({
9392
size: 10,
9493
},
9594
aggs: {
96-
alerts: interval ? dateHistogram : autoDateHistogram,
95+
alerts: dateHistogram,
9796
},
9897
},
9998
};

x-pack/legacy/plugins/siem/server/lib/anomalies/query.anomalies_over_time.dsl.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query';
7+
import { createQueryFilterClauses, calculateTimeSeriesInterval } from '../../utils/build_query';
88
import { MatrixHistogramRequestOptions } from '../framework';
99

1010
export const buildAnomaliesOverTimeQuery = ({
@@ -26,18 +26,17 @@ export const buildAnomaliesOverTimeQuery = ({
2626
];
2727

2828
const getHistogramAggregation = () => {
29-
const interval = calculateTimeseriesInterval(from, to);
29+
const interval = calculateTimeSeriesInterval(from, to);
3030
const histogramTimestampField = 'timestamp';
3131
const dateHistogram = {
3232
date_histogram: {
3333
field: histogramTimestampField,
34-
fixed_interval: `${interval}s`,
35-
},
36-
};
37-
const autoDateHistogram = {
38-
auto_date_histogram: {
39-
field: histogramTimestampField,
40-
buckets: 36,
34+
fixed_interval: interval,
35+
min_doc_count: 0,
36+
extended_bounds: {
37+
min: from,
38+
max: to,
39+
},
4140
},
4241
};
4342
return {
@@ -50,7 +49,7 @@ export const buildAnomaliesOverTimeQuery = ({
5049
size: 10,
5150
},
5251
aggs: {
53-
anomalies: interval ? dateHistogram : autoDateHistogram,
52+
anomalies: dateHistogram,
5453
},
5554
},
5655
};

x-pack/legacy/plugins/siem/server/lib/authentications/query.authentications_over_time.dsl.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query';
6+
import { createQueryFilterClauses, calculateTimeSeriesInterval } from '../../utils/build_query';
77
import { MatrixHistogramRequestOptions } from '../framework';
88

99
export const buildAuthenticationsOverTimeQuery = ({
@@ -28,18 +28,17 @@ export const buildAuthenticationsOverTimeQuery = ({
2828
];
2929

3030
const getHistogramAggregation = () => {
31-
const interval = calculateTimeseriesInterval(from, to);
31+
const interval = calculateTimeSeriesInterval(from, to);
3232
const histogramTimestampField = '@timestamp';
3333
const dateHistogram = {
3434
date_histogram: {
3535
field: histogramTimestampField,
36-
fixed_interval: `${interval}s`,
37-
},
38-
};
39-
const autoDateHistogram = {
40-
auto_date_histogram: {
41-
field: histogramTimestampField,
42-
buckets: 36,
36+
fixed_interval: interval,
37+
min_doc_count: 0,
38+
extended_bounds: {
39+
min: from,
40+
max: to,
41+
},
4342
},
4443
};
4544
return {
@@ -53,7 +52,7 @@ export const buildAuthenticationsOverTimeQuery = ({
5352
size: 2,
5453
},
5554
aggs: {
56-
events: interval ? dateHistogram : autoDateHistogram,
55+
events: dateHistogram,
5756
},
5857
},
5958
};

x-pack/legacy/plugins/siem/server/lib/events/query.events_over_time.dsl.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query';
6+
import { createQueryFilterClauses, calculateTimeSeriesInterval } from '../../utils/build_query';
77
import { MatrixHistogramRequestOptions } from '../framework';
88

99
export const buildEventsOverTimeQuery = ({
@@ -28,18 +28,17 @@ export const buildEventsOverTimeQuery = ({
2828
];
2929

3030
const getHistogramAggregation = () => {
31-
const interval = calculateTimeseriesInterval(from, to);
31+
const interval = calculateTimeSeriesInterval(from, to);
3232
const histogramTimestampField = '@timestamp';
3333
const dateHistogram = {
3434
date_histogram: {
3535
field: histogramTimestampField,
36-
fixed_interval: `${interval}s`,
37-
},
38-
};
39-
const autoDateHistogram = {
40-
auto_date_histogram: {
41-
field: histogramTimestampField,
42-
buckets: 36,
36+
fixed_interval: interval,
37+
min_doc_count: 0,
38+
extended_bounds: {
39+
min: from,
40+
max: to,
41+
},
4342
},
4443
};
4544
return {
@@ -53,7 +52,7 @@ export const buildEventsOverTimeQuery = ({
5352
size: 10,
5453
},
5554
aggs: {
56-
events: interval ? dateHistogram : autoDateHistogram,
55+
events: dateHistogram,
5756
},
5857
},
5958
};

x-pack/legacy/plugins/siem/server/lib/network/query_dns_histogram.dsl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query';
7+
import { createQueryFilterClauses, calculateTimeSeriesInterval } from '../../utils/build_query';
88
import { MatrixHistogramRequestOptions } from '../framework';
99

1010
export const buildDnsHistogramQuery = ({
@@ -29,12 +29,12 @@ export const buildDnsHistogramQuery = ({
2929
];
3030

3131
const getHistogramAggregation = () => {
32-
const interval = calculateTimeseriesInterval(from, to);
32+
const interval = calculateTimeSeriesInterval(from, to);
3333
const histogramTimestampField = '@timestamp';
3434
const dateHistogram = {
3535
date_histogram: {
3636
field: histogramTimestampField,
37-
fixed_interval: `${interval}s`,
37+
fixed_interval: interval,
3838
},
3939
};
4040

0 commit comments

Comments
 (0)