mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* update visualizationType
* update labels
* add snapshots for charts
(cherry picked from commit d915169c50
)
This commit is contained in:
parent
30b43ff67f
commit
0f4073bd2d
72 changed files with 5909 additions and 93 deletions
|
@ -0,0 +1,276 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`authenticationLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-3fd0c5d5-f762-4a27-8c56-14eee0223e13",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-bef502be-e5ff-442f-9e3e-229f86ca2afa",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "6f4dbdc7-35b6-4e20-ac53-1272167e3919",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"3fd0c5d5-f762-4a27-8c56-14eee0223e13": Object {
|
||||
"columnOrder": Array [
|
||||
"b41a2958-650b-470a-84c4-c6fd8f0c6d37",
|
||||
"5417777d-d9d9-4268-9cdc-eb29b873bd65",
|
||||
],
|
||||
"columns": Object {
|
||||
"5417777d-d9d9-4268-9cdc-eb29b873bd65": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"success\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Success",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"b41a2958-650b-470a-84c4-c6fd8f0c6d37": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"bef502be-e5ff-442f-9e3e-229f86ca2afa": Object {
|
||||
"columnOrder": Array [
|
||||
"cded27f7-8ef8-458c-8d9b-70db48ae340d",
|
||||
"a3bf9dc1-c8d2-42d6-9e60-31892a4c509e",
|
||||
],
|
||||
"columns": Object {
|
||||
"a3bf9dc1-c8d2-42d6-9e60-31892a4c509e": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"failure\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Failure",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"cded27f7-8ef8-458c-8d9b-70db48ae340d": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "6f4dbdc7-35b6-4e20-ac53-1272167e3919",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"must\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"must": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"event.category": "authentication",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"5417777d-d9d9-4268-9cdc-eb29b873bd65",
|
||||
],
|
||||
"layerId": "3fd0c5d5-f762-4a27-8c56-14eee0223e13",
|
||||
"layerType": "data",
|
||||
"position": "top",
|
||||
"seriesType": "bar_stacked",
|
||||
"showGridlines": false,
|
||||
"xAccessor": "b41a2958-650b-470a-84c4-c6fd8f0c6d37",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#54b399",
|
||||
"forAccessor": "5417777d-d9d9-4268-9cdc-eb29b873bd65",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"a3bf9dc1-c8d2-42d6-9e60-31892a4c509e",
|
||||
],
|
||||
"layerId": "bef502be-e5ff-442f-9e3e-229f86ca2afa",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_stacked",
|
||||
"xAccessor": "cded27f7-8ef8-458c-8d9b-70db48ae340d",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#da8b45",
|
||||
"forAccessor": "a3bf9dc1-c8d2-42d6-9e60-31892a4c509e",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "bar_stacked",
|
||||
"title": "Empty XY chart",
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "Authentication",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,231 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`getExternalAlertLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-a3c54471-615f-4ff9-9fda-69b5b2ea3eef",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "723c4653-681b-4105-956e-abef287bf025",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "a04472fc-94a3-4b8d-ae05-9d30ea8fbd6a",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"a3c54471-615f-4ff9-9fda-69b5b2ea3eef": Object {
|
||||
"columnOrder": Array [
|
||||
"42334c6e-98d9-47a2-b4cb-a445abb44c93",
|
||||
"37bdf546-3c11-4b08-8c5d-e37debc44f1d",
|
||||
"0a923af2-c880-4aa3-aa93-a0b9c2801f6d",
|
||||
],
|
||||
"columns": Object {
|
||||
"0a923af2-c880-4aa3-aa93-a0b9c2801f6d": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Count of records",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"37bdf546-3c11-4b08-8c5d-e37debc44f1d": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"42334c6e-98d9-47a2-b4cb-a445abb44c93": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Top values of event.dataset",
|
||||
"operationType": "terms",
|
||||
"params": Object {
|
||||
"missingBucket": false,
|
||||
"orderBy": Object {
|
||||
"columnId": "0a923af2-c880-4aa3-aa93-a0b9c2801f6d",
|
||||
"type": "column",
|
||||
},
|
||||
"orderDirection": "desc",
|
||||
"otherBucket": true,
|
||||
"parentFormat": Object {
|
||||
"id": "terms",
|
||||
},
|
||||
"size": 10,
|
||||
},
|
||||
"scale": "ordinal",
|
||||
"sourceField": "event.dataset",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "a04472fc-94a3-4b8d-ae05-9d30ea8fbd6a",
|
||||
"key": "event.kind",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "alert",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"event.kind": "alert",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"0a923af2-c880-4aa3-aa93-a0b9c2801f6d",
|
||||
],
|
||||
"layerId": "a3c54471-615f-4ff9-9fda-69b5b2ea3eef",
|
||||
"layerType": "data",
|
||||
"position": "top",
|
||||
"seriesType": "bar_stacked",
|
||||
"showGridlines": false,
|
||||
"splitAccessor": "42334c6e-98d9-47a2-b4cb-a445abb44c93",
|
||||
"xAccessor": "37bdf546-3c11-4b08-8c5d-e37debc44f1d",
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "bar_stacked",
|
||||
"title": "Empty XY chart",
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "External alerts",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { authenticationLensAttributes } from './authentication';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('authenticationLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: authenticationLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
AUTHENCICATION_FAILURE_CHART_LABEL,
|
||||
AUTHENCICATION_SUCCESS_CHART_LABEL,
|
||||
} from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const authenticationLensAttributes: LensAttributes = {
|
||||
|
@ -110,7 +114,7 @@ export const authenticationLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
'5417777d-d9d9-4268-9cdc-eb29b873bd65': {
|
||||
label: 'Success',
|
||||
label: AUTHENCICATION_SUCCESS_CHART_LABEL,
|
||||
dataType: 'number',
|
||||
operationType: 'count',
|
||||
isBucketed: false,
|
||||
|
@ -143,7 +147,7 @@ export const authenticationLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
'a3bf9dc1-c8d2-42d6-9e60-31892a4c509e': {
|
||||
label: 'Failure',
|
||||
label: AUTHENCICATION_FAILURE_CHART_LABEL,
|
||||
dataType: 'number',
|
||||
operationType: 'count',
|
||||
isBucketed: false,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { getExternalAlertLensAttributes } from './external_alert';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('getExternalAlertLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
getLensAttributes: getExternalAlertLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { COUNT, TOP_VALUE } from '../../translations';
|
||||
import type { GetLensAttributes, LensAttributes } from '../../types';
|
||||
|
||||
export const getExternalAlertLensAttributes: GetLensAttributes = (
|
||||
|
@ -86,7 +87,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = (
|
|||
},
|
||||
},
|
||||
'0a923af2-c880-4aa3-aa93-a0b9c2801f6d': {
|
||||
label: 'Count of records',
|
||||
label: COUNT,
|
||||
dataType: 'number',
|
||||
operationType: 'count',
|
||||
isBucketed: false,
|
||||
|
@ -94,7 +95,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = (
|
|||
sourceField: '___records___',
|
||||
},
|
||||
'42334c6e-98d9-47a2-b4cb-a445abb44c93': {
|
||||
label: `Top values of ${stackByField}`, // could be event.category
|
||||
label: TOP_VALUE(`${stackByField}`), // could be event.category
|
||||
dataType: 'string',
|
||||
operationType: 'terms',
|
||||
scale: 'ordinal',
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`getEventsHistogramLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-0039eb0c-9a1a-4687-ae54-0f4e239bec75",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"0039eb0c-9a1a-4687-ae54-0f4e239bec75": Object {
|
||||
"columnOrder": Array [
|
||||
"34919782-4546-43a5-b668-06ac934d3acd",
|
||||
"aac9d7d0-13a3-480a-892b-08207a787926",
|
||||
"e09e0380-0740-4105-becc-0a4ca12e3944",
|
||||
],
|
||||
"columns": Object {
|
||||
"34919782-4546-43a5-b668-06ac934d3acd": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Top values of event.dataset",
|
||||
"operationType": "terms",
|
||||
"params": Object {
|
||||
"missingBucket": false,
|
||||
"orderBy": Object {
|
||||
"columnId": "e09e0380-0740-4105-becc-0a4ca12e3944",
|
||||
"type": "column",
|
||||
},
|
||||
"orderDirection": "asc",
|
||||
"otherBucket": true,
|
||||
"parentFormat": Object {
|
||||
"id": "terms",
|
||||
},
|
||||
"size": 10,
|
||||
},
|
||||
"scale": "ordinal",
|
||||
"sourceField": "event.dataset",
|
||||
},
|
||||
"aac9d7d0-13a3-480a-892b-08207a787926": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"e09e0380-0740-4105-becc-0a4ca12e3944": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Count of records",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"e09e0380-0740-4105-becc-0a4ca12e3944",
|
||||
],
|
||||
"layerId": "0039eb0c-9a1a-4687-ae54-0f4e239bec75",
|
||||
"layerType": "data",
|
||||
"position": "top",
|
||||
"seriesType": "bar_stacked",
|
||||
"showGridlines": false,
|
||||
"splitAccessor": "34919782-4546-43a5-b668-06ac934d3acd",
|
||||
"xAccessor": "aac9d7d0-13a3-480a-892b-08207a787926",
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "bar_stacked",
|
||||
"title": "Empty XY chart",
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "Host - events",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,196 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiHostAreaLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"416b6fad-1923-4f6a-a2df-b223bb287e30": Object {
|
||||
"columnOrder": Array [
|
||||
"5eea817b-67b7-4268-8ecb-7688d1094721",
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
],
|
||||
"columns": Object {
|
||||
"5eea817b-67b7-4268-8ecb-7688d1094721": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of host.name",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "host.name",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": false,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
],
|
||||
"layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "5eea817b-67b7-4268-8ecb-7688d1094721",
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "area",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Host] Hosts - area",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,143 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiHostMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"416b6fad-1923-4f6a-a2df-b223bb287e30": Object {
|
||||
"columnOrder": Array [
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
],
|
||||
"columns": Object {
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "host.name",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
"layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Host] Hosts - metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,255 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniqueIpsAreaLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-ca05ecdb-0fa4-49a8-9305-b23d91012a46",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object {
|
||||
"columnOrder": Array [
|
||||
"a0cb6400-f708-46c3-ad96-24788f12dae4",
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
],
|
||||
"columns": Object {
|
||||
"a0cb6400-f708-46c3-ad96-24788f12dae4": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Src.",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"ca05ecdb-0fa4-49a8-9305-b23d91012a46": Object {
|
||||
"columnOrder": Array [
|
||||
"f95e74e6-99dd-4b11-8faf-439b4d959df9",
|
||||
"e7052671-fb9e-481f-8df3-7724c98cfc6f",
|
||||
],
|
||||
"columns": Object {
|
||||
"e7052671-fb9e-481f-8df3-7724c98cfc6f": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Dest.",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
"f95e74e6-99dd-4b11-8faf-439b4d959df9": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
],
|
||||
"layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "a0cb6400-f708-46c3-ad96-24788f12dae4",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#d36186",
|
||||
"forAccessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"e7052671-fb9e-481f-8df3-7724c98cfc6f",
|
||||
],
|
||||
"layerId": "ca05ecdb-0fa4-49a8-9305-b23d91012a46",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "f95e74e6-99dd-4b11-8faf-439b4d959df9",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#9170b8",
|
||||
"forAccessor": "e7052671-fb9e-481f-8df3-7724c98cfc6f",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "area",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Host] Unique IPs - area",
|
||||
"type": "lens",
|
||||
"updated_at": "2022-02-09T17:44:03.359Z",
|
||||
"version": "WzI5MTI5OSwzXQ==",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,265 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniqueIpsBarLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object {
|
||||
"columnOrder": Array [
|
||||
"f8bfa719-5c1c-4bf2-896e-c318d77fc08e",
|
||||
"32f66676-f4e1-48fd-b7f8-d4de38318601",
|
||||
],
|
||||
"columns": Object {
|
||||
"32f66676-f4e1-48fd-b7f8-d4de38318601": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of source.ip",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
"f8bfa719-5c1c-4bf2-896e-c318d77fc08e": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Filters",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "",
|
||||
},
|
||||
"label": "Src.",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e": Object {
|
||||
"columnOrder": Array [
|
||||
"c72aad6a-fc9c-43dc-9194-e13ca3ee8aff",
|
||||
"b7e59b08-96e6-40d1-84fd-e97b977d1c47",
|
||||
],
|
||||
"columns": Object {
|
||||
"b7e59b08-96e6-40d1-84fd-e97b977d1c47": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of destination.ip",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
"c72aad6a-fc9c-43dc-9194-e13ca3ee8aff": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Dest.",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "",
|
||||
},
|
||||
"label": "Dest.",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"32f66676-f4e1-48fd-b7f8-d4de38318601",
|
||||
],
|
||||
"layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"xAccessor": "f8bfa719-5c1c-4bf2-896e-c318d77fc08e",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#d36186",
|
||||
"forAccessor": "32f66676-f4e1-48fd-b7f8-d4de38318601",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"b7e59b08-96e6-40d1-84fd-e97b977d1c47",
|
||||
],
|
||||
"layerId": "ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"xAccessor": "c72aad6a-fc9c-43dc-9194-e13ca3ee8aff",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#9170b8",
|
||||
"forAccessor": "b7e59b08-96e6-40d1-84fd-e97b977d1c47",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "bar_horizontal_stacked",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Host] Unique IPs - bar",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,143 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniqueIpsDestinationMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object {
|
||||
"columnOrder": Array [
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
],
|
||||
"columns": Object {
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
"layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Host] Unique IPs - destination metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,143 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniqueIpsSourceMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object {
|
||||
"columnOrder": Array [
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
],
|
||||
"columns": Object {
|
||||
"d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.name",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "mockHost",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.name": "mockHost",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "host.name",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe",
|
||||
"layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Host] Unique IPs - source metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { getEventsHistogramLensAttributes } from './events';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('getEventsHistogramLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
getLensAttributes: getEventsHistogramLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiHostAreaLensAttributes } from './kpi_host_area';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiHostAreaLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiHostAreaLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UNIQUE_COUNT } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const kpiHostAreaLensAttributes: LensAttributes = {
|
||||
|
@ -32,7 +33,7 @@ export const kpiHostAreaLensAttributes: LensAttributes = {
|
|||
customLabel: true,
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
label: ' ',
|
||||
label: UNIQUE_COUNT('host.name'),
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
sourceField: 'host.name',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiHostMetricLensAttributes } from './kpi_host_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiHostMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiHostMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -40,7 +40,7 @@ export const kpiHostMetricLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
title: '[Host] Hosts - metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniqueIpsAreaLensAttributes } from './kpi_unique_ips_area';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniqueIpsAreaLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniqueIpsAreaLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniqueIpsBarLensAttributes } from './kpi_unique_ips_bar';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniqueIpsBarLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniqueIpsBarLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { LensAttributes } from '../../types';
|
||||
import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL } from '../../translations';
|
||||
import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL, UNIQUE_COUNT } from '../../translations';
|
||||
|
||||
export const kpiUniqueIpsBarLensAttributes: LensAttributes = {
|
||||
description: '',
|
||||
|
@ -23,7 +23,7 @@ export const kpiUniqueIpsBarLensAttributes: LensAttributes = {
|
|||
'32f66676-f4e1-48fd-b7f8-d4de38318601': {
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
label: 'Unique count of source.ip',
|
||||
label: UNIQUE_COUNT('source.ip'),
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
sourceField: 'source.ip',
|
||||
|
@ -50,7 +50,7 @@ export const kpiUniqueIpsBarLensAttributes: LensAttributes = {
|
|||
'b7e59b08-96e6-40d1-84fd-e97b977d1c47': {
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
label: 'Unique count of destination.ip',
|
||||
label: UNIQUE_COUNT('destination.ip'),
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
sourceField: 'destination.ip',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniqueIpsDestinationMetricLensAttributes } from './kpi_unique_ips_destination_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniqueIpsDestinationMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniqueIpsDestinationMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -40,7 +40,7 @@ export const kpiUniqueIpsDestinationMetricLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
title: '[Host] Unique IPs - destination metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniqueIpsSourceMetricLensAttributes } from './kpi_unique_ips_source_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'hosts',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniqueIpsSourceMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniqueIpsSourceMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -40,7 +40,7 @@ export const kpiUniqueIpsSourceMetricLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
title: '[Host] Unique IPs - source metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`dnsTopDomainsLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "Security Solution Network DNS",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-b1c3efc6-c886-4fba-978f-3b6bb5e7948a",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "filter-index-pattern-0",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"b1c3efc6-c886-4fba-978f-3b6bb5e7948a": Object {
|
||||
"columnOrder": Array [
|
||||
"e8842815-2a45-4c74-86de-c19a391e2424",
|
||||
"d1452b87-0e9e-4fc0-a725-3727a18e0b37",
|
||||
"2a4d5e20-f570-48e4-b9ab-ff3068919377",
|
||||
],
|
||||
"columns": Object {
|
||||
"2a4d5e20-f570-48e4-b9ab-ff3068919377": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of dns.question.registered_domain",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "dns.question.registered_domain",
|
||||
},
|
||||
"d1452b87-0e9e-4fc0-a725-3727a18e0b37": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"e8842815-2a45-4c74-86de-c19a391e2424": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Top values of dns.question.name",
|
||||
"operationType": "terms",
|
||||
"params": Object {
|
||||
"missingBucket": false,
|
||||
"orderBy": Object {
|
||||
"columnId": "2a4d5e20-f570-48e4-b9ab-ff3068919377",
|
||||
"type": "column",
|
||||
},
|
||||
"orderDirection": "desc",
|
||||
"otherBucket": true,
|
||||
"size": 6,
|
||||
},
|
||||
"scale": "ordinal",
|
||||
"sourceField": "dns.question.name",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"indexRefName": "filter-index-pattern-0",
|
||||
"key": "dns.question.type",
|
||||
"negate": true,
|
||||
"params": Object {
|
||||
"query": "PTR",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"dns.question.type": "PTR",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"2a4d5e20-f570-48e4-b9ab-ff3068919377",
|
||||
],
|
||||
"layerId": "b1c3efc6-c886-4fba-978f-3b6bb5e7948a",
|
||||
"layerType": "data",
|
||||
"position": "top",
|
||||
"seriesType": "bar",
|
||||
"showGridlines": false,
|
||||
"splitAccessor": "e8842815-2a45-4c74-86de-c19a391e2424",
|
||||
"xAccessor": "d1452b87-0e9e-4fc0-a725-3727a18e0b37",
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "bar",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "Top domains by dns.question.registered_domain",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,189 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiDnsQueriesLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "196d783b-3779-4c39-898e-6606fe633d05",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object {
|
||||
"columnOrder": Array [
|
||||
"0374e520-eae0-4ac1-bcfe-37565e7fc9e3",
|
||||
],
|
||||
"columns": Object {
|
||||
"0374e520-eae0-4ac1-bcfe-37565e7fc9e3": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "196d783b-3779-4c39-898e-6606fe633d05",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"dns.question.name\\"}},{\\"term\\":{\\"suricata.eve.dns.type\\":{\\"value\\":\\"query\\"}}},{\\"exists\\":{\\"field\\":\\"zeek.dns.query\\"}}],\\"minimum_should_match\\":1}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "dns.question.name",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"term": Object {
|
||||
"suricata.eve.dns.type": Object {
|
||||
"value": "query",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "zeek.dns.query",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "0374e520-eae0-4ac1-bcfe-37565e7fc9e3",
|
||||
"colorMode": "None",
|
||||
"layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] DNS metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,193 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiNetworkEventsLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-eaadfec7-deaa-4aeb-a403-3b4e516416d2",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "861af17d-be25-45a3-a82d-d6e697b76e51",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "09617767-f732-410e-af53-bebcbd0bf4b9",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"eaadfec7-deaa-4aeb-a403-3b4e516416d2": Object {
|
||||
"columnOrder": Array [
|
||||
"370ebd07-5ce0-4f46-a847-0e363c50d037",
|
||||
],
|
||||
"columns": Object {
|
||||
"370ebd07-5ce0-4f46-a847-0e363c50d037": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "security-solution-default",
|
||||
"key": "source.ip",
|
||||
"negate": false,
|
||||
"type": "exists",
|
||||
"value": "exists",
|
||||
},
|
||||
"query": Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "security-solution-default",
|
||||
"key": "destination.ip",
|
||||
"negate": false,
|
||||
"type": "exists",
|
||||
"value": "exists",
|
||||
},
|
||||
"query": Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "370ebd07-5ce0-4f46-a847-0e363c50d037",
|
||||
"layerId": "eaadfec7-deaa-4aeb-a403-3b4e516416d2",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] Network events",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,212 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiTlsHandshakesLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-1f48a633-8eee-45ae-9471-861227e9ca03",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"1f48a633-8eee-45ae-9471-861227e9ca03": Object {
|
||||
"columnOrder": Array [
|
||||
"21052b6b-5504-4084-a2e2-c17f772345cf",
|
||||
],
|
||||
"columns": Object {
|
||||
"21052b6b-5504-4084-a2e2-c17f772345cf": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "32ee22d9-2e77-4aee-8073-87750e92c3ee",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"source.ip\\"}},{\\"exists\\":{\\"field\\":\\"destination.ip\\"}}],\\"minimum_should_match\\":1}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "1e93f984-9374-4755-a198-de57751533c6",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"tls.version\\"}},{\\"exists\\":{\\"field\\":\\"suricata.eve.tls.version\\"}},{\\"exists\\":{\\"field\\":\\"zeek.ssl.version\\"}}],\\"minimum_should_match\\":1}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "tls.version",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "suricata.eve.tls.version",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "zeek.ssl.version",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "21052b6b-5504-4084-a2e2-c17f772345cf",
|
||||
"layerId": "1f48a633-8eee-45ae-9471-861227e9ca03",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] TLS handshakes",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,176 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniqueFlowIdsLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-5d46d48f-6ce8-46be-a797-17ad50642564",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"5d46d48f-6ce8-46be-a797-17ad50642564": Object {
|
||||
"columnOrder": Array [
|
||||
"a27f3503-9c73-4fc1-86bb-12461dae4b70",
|
||||
],
|
||||
"columns": Object {
|
||||
"a27f3503-9c73-4fc1-86bb-12461dae4b70": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "network.community_id",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"index": "c01edc8a-90ce-4d49-95f0-76954a034eb2",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"source.ip\\"}},{\\"exists\\":{\\"field\\":\\"destination.ip\\"}}],\\"minimum_should_match\\":1}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "a27f3503-9c73-4fc1-86bb-12461dae4b70",
|
||||
"layerId": "5d46d48f-6ce8-46be-a797-17ad50642564",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] Unique flow IDs",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,261 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniquePrivateIpsAreaLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-72dc4b99-b07d-4dc9-958b-081d259e11fa",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object {
|
||||
"columnOrder": Array [
|
||||
"662cd5e5-82bf-4325-a703-273f84b97e09",
|
||||
"5f317308-cfbb-4ee5-bfb9-07653184fabf",
|
||||
],
|
||||
"columns": Object {
|
||||
"5f317308-cfbb-4ee5-bfb9-07653184fabf": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "\\"source.ip\\": \\"10.0.0.0/8\\" or \\"source.ip\\": \\"192.168.0.0/16\\" or \\"source.ip\\": \\"172.16.0.0/12\\" or \\"source.ip\\": \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Src.",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
"662cd5e5-82bf-4325-a703-273f84b97e09": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"72dc4b99-b07d-4dc9-958b-081d259e11fa": Object {
|
||||
"columnOrder": Array [
|
||||
"36444b8c-7e10-4069-8298-6c1b46912be2",
|
||||
"ac1eb80c-ddde-46c4-a90c-400261926762",
|
||||
],
|
||||
"columns": Object {
|
||||
"36444b8c-7e10-4069-8298-6c1b46912be2": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"ac1eb80c-ddde-46c4-a90c-400261926762": Object {
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Dest.",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"5f317308-cfbb-4ee5-bfb9-07653184fabf",
|
||||
],
|
||||
"layerId": "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "662cd5e5-82bf-4325-a703-273f84b97e09",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#d36186",
|
||||
"forAccessor": "5f317308-cfbb-4ee5-bfb9-07653184fabf",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"ac1eb80c-ddde-46c4-a90c-400261926762",
|
||||
],
|
||||
"layerId": "72dc4b99-b07d-4dc9-958b-081d259e11fa",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "36444b8c-7e10-4069-8298-6c1b46912be2",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#9170b8",
|
||||
"forAccessor": "ac1eb80c-ddde-46c4-a90c-400261926762",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "area",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Network] Unique private IPs - area chart",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,276 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniquePrivateIpsBarLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-e406bf4f-942b-41ac-b516-edb5cef06ec8",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object {
|
||||
"columnOrder": Array [
|
||||
"4607c585-3af3-43b9-804f-e49b27796d79",
|
||||
"d27e0966-daf9-41f4-9033-230cf1e76dc9",
|
||||
],
|
||||
"columns": Object {
|
||||
"4607c585-3af3-43b9-804f-e49b27796d79": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Filters",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "",
|
||||
},
|
||||
"label": "Dest.",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
"d27e0966-daf9-41f4-9033-230cf1e76dc9": Object {
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of destination.ip",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"e406bf4f-942b-41ac-b516-edb5cef06ec8": Object {
|
||||
"columnOrder": Array [
|
||||
"d9c438c5-f776-4436-9d20-d62dc8c03be8",
|
||||
"5acd4c9d-dc3b-4b21-9632-e4407944c36d",
|
||||
],
|
||||
"columns": Object {
|
||||
"5acd4c9d-dc3b-4b21-9632-e4407944c36d": Object {
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "source.ip: \\"10.0.0.0/8\\" or source.ip: \\"192.168.0.0/16\\" or source.ip: \\"172.16.0.0/12\\" or source.ip: \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of source.ip",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
"d9c438c5-f776-4436-9d20-d62dc8c03be8": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Filters",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "",
|
||||
},
|
||||
"label": "Src.",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"5acd4c9d-dc3b-4b21-9632-e4407944c36d",
|
||||
],
|
||||
"layerId": "e406bf4f-942b-41ac-b516-edb5cef06ec8",
|
||||
"layerType": "data",
|
||||
"position": "top",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"showGridlines": false,
|
||||
"xAccessor": "d9c438c5-f776-4436-9d20-d62dc8c03be8",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#d36186",
|
||||
"forAccessor": "5acd4c9d-dc3b-4b21-9632-e4407944c36d",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"d27e0966-daf9-41f4-9033-230cf1e76dc9",
|
||||
],
|
||||
"layerId": "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"xAccessor": "4607c585-3af3-43b9-804f-e49b27796d79",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#9170b8",
|
||||
"forAccessor": "d27e0966-daf9-41f4-9033-230cf1e76dc9",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "bar_horizontal_stacked",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Network] Unique private IPs - bar chart",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,149 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniquePrivateIpsDestinationMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object {
|
||||
"columnOrder": Array [
|
||||
"bd17c23e-4f83-4108-8005-2669170d064b",
|
||||
],
|
||||
"columns": Object {
|
||||
"bd17c23e-4f83-4108-8005-2669170d064b": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "destination.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "bd17c23e-4f83-4108-8005-2669170d064b",
|
||||
"layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] Unique private IPs - destination metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,149 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUniquePrivateIpsSourceMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object {
|
||||
"columnOrder": Array [
|
||||
"bd17c23e-4f83-4108-8005-2669170d064b",
|
||||
],
|
||||
"columns": Object {
|
||||
"bd17c23e-4f83-4108-8005-2669170d064b": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "source.ip: \\"10.0.0.0/8\\" or source.ip: \\"192.168.0.0/16\\" or source.ip: \\"172.16.0.0/12\\" or source.ip: \\"fd00::/8\\"",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "source.ip",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": "",
|
||||
"disabled": false,
|
||||
"key": "bool",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "source.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"exists": Object {
|
||||
"field": "destination.ip",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "bd17c23e-4f83-4108-8005-2669170d064b",
|
||||
"layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Network] Unique private IPs - source metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { dnsTopDomainsLensAttributes } from './dns_top_domains';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('dnsTopDomainsLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: dnsTopDomainsLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TOP_VALUE, UNIQUE_COUNT } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
/* Exported from Kibana Saved Object */
|
||||
|
@ -104,7 +105,7 @@ export const dnsTopDomainsLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
'2a4d5e20-f570-48e4-b9ab-ff3068919377': {
|
||||
label: 'Unique count of dns.question.registered_domain',
|
||||
label: UNIQUE_COUNT('dns.question.registered_domain'),
|
||||
dataType: 'number',
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
|
@ -112,7 +113,7 @@ export const dnsTopDomainsLensAttributes: LensAttributes = {
|
|||
isBucketed: false,
|
||||
},
|
||||
'e8842815-2a45-4c74-86de-c19a391e2424': {
|
||||
label: 'Top values of dns.question.name',
|
||||
label: TOP_VALUE('dns.question.name'),
|
||||
dataType: 'string',
|
||||
operationType: 'terms',
|
||||
scale: 'ordinal',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiDnsQueriesLensAttributes } from './kpi_dns_queries';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiDnsQueriesLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiDnsQueriesLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiDnsQueriesLensAttributes: LensAttributes = {
|
||||
title: '[Network] DNS metric',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
layerId: 'cea37c70-8f91-43bf-b9fe-72d8c049f6a3',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiNetworkEventsLensAttributes } from './kpi_network_events';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiNetworkEventsLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiNetworkEventsLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiNetworkEventsLensAttributes: LensAttributes = {
|
||||
title: '[Network] Network events',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
layerId: 'eaadfec7-deaa-4aeb-a403-3b4e516416d2',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiTlsHandshakesLensAttributes } from './kpi_tls_handshakes';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiTlsHandshakesLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiTlsHandshakesLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -9,7 +9,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiTlsHandshakesLensAttributes: LensAttributes = {
|
||||
title: '[Network] TLS handshakes',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
layerId: '1f48a633-8eee-45ae-9471-861227e9ca03',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniqueFlowIdsLensAttributes } from './kpi_unique_flow_ids';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniqueFlowIdsLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniqueFlowIdsLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiUniqueFlowIdsLensAttributes: LensAttributes = {
|
||||
title: '[Network] Unique flow IDs',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
layerId: '5d46d48f-6ce8-46be-a797-17ad50642564',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniquePrivateIpsAreaLensAttributes } from './kpi_unique_private_ips_area';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniquePrivateIpsAreaLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniquePrivateIpsAreaLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -4,6 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { DESTINATION_CHART_LABEL, SOURCE_CHART_LABEL } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = {
|
||||
|
@ -97,7 +98,7 @@ export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
'5f317308-cfbb-4ee5-bfb9-07653184fabf': {
|
||||
label: 'Src.',
|
||||
label: SOURCE_CHART_LABEL,
|
||||
dataType: 'number',
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
|
@ -131,7 +132,7 @@ export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
'ac1eb80c-ddde-46c4-a90c-400261926762': {
|
||||
label: 'Dest.',
|
||||
label: DESTINATION_CHART_LABEL,
|
||||
dataType: 'number',
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniquePrivateIpsBarLensAttributes } from './kpi_unique_private_ips_bar';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniquePrivateIpsBarLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniquePrivateIpsBarLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL } from '../../translations';
|
||||
import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL, UNIQUE_COUNT } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = {
|
||||
|
@ -90,7 +90,7 @@ export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = {
|
|||
'e406bf4f-942b-41ac-b516-edb5cef06ec8': {
|
||||
columns: {
|
||||
'5acd4c9d-dc3b-4b21-9632-e4407944c36d': {
|
||||
label: SOURCE_CHART_LABEL,
|
||||
label: UNIQUE_COUNT('source.ip'),
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
operationType: 'unique_count',
|
||||
|
@ -130,7 +130,7 @@ export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = {
|
|||
'38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7': {
|
||||
columns: {
|
||||
'd27e0966-daf9-41f4-9033-230cf1e76dc9': {
|
||||
label: DESTINATION_CHART_LABEL,
|
||||
label: UNIQUE_COUNT('destination.ip'),
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
operationType: 'unique_count',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniquePrivateIpsDestinationMetricLensAttributes } from './kpi_unique_private_ips_destination_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniquePrivateIpsDestinationMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniquePrivateIpsDestinationMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -48,7 +48,7 @@ export const kpiUniquePrivateIpsDestinationMetricLensAttributes: LensAttributes
|
|||
},
|
||||
},
|
||||
title: '[Network] Unique private IPs - destination metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUniquePrivateIpsSourceMetricLensAttributes } from './kpi_unique_private_ips_source_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'network',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUniquePrivateIpsSourceMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUniquePrivateIpsSourceMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -47,7 +47,7 @@ export const kpiUniquePrivateIpsSourceMetricLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
title: '[Network] Unique private IPs - source metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiTotalUsersAreaLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"416b6fad-1923-4f6a-a2df-b223bb287e30": Object {
|
||||
"columnOrder": Array [
|
||||
"5eea817b-67b7-4268-8ecb-7688d1094721",
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
],
|
||||
"columns": Object {
|
||||
"5eea817b-67b7-4268-8ecb-7688d1094721": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Unique count of user.name",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "user.name",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": false,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"b00c65ea-32be-4163-bfc8-f795b1ef9d06",
|
||||
],
|
||||
"layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "5eea817b-67b7-4268-8ecb-7688d1094721",
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": true,
|
||||
"position": "right",
|
||||
},
|
||||
"preferredSeriesType": "area",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[User] Users - area",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,97 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiTotalUsersMetricLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"416b6fad-1923-4f6a-a2df-b223bb287e30": Object {
|
||||
"columnOrder": Array [
|
||||
"3e51b035-872c-4b44-824b-fe069c222e91",
|
||||
],
|
||||
"columns": Object {
|
||||
"3e51b035-872c-4b44-824b-fe069c222e91": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "unique_count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "user.name",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "3e51b035-872c-4b44-824b-fe069c222e91",
|
||||
"layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[User] Users - metric",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,126 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUserAuthenticationsMetricFailureLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object {
|
||||
"columnOrder": Array [
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
],
|
||||
"columns": Object {
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7": Object {
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"failure\\" ",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"indexRefName": "filter-index-pattern-0",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"event.category": "authentication",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
"layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Host] User authentications - metric failure ",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,240 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUserAuthenticationsAreaLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "{dataViewId}",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-31213ae3-905b-4e88-b987-0cccb1f3209f",
|
||||
"type": "{dataViewId}",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"type": "{dataViewId}",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"31213ae3-905b-4e88-b987-0cccb1f3209f": Object {
|
||||
"columnOrder": Array [
|
||||
"33a6163d-0c0a-451d-aa38-8ca6010dd5bf",
|
||||
"2b27c80e-a20d-46f1-8fb2-79626ef4563c",
|
||||
],
|
||||
"columns": Object {
|
||||
"2b27c80e-a20d-46f1-8fb2-79626ef4563c": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome: \\"failure\\" ",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Fail",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"33a6163d-0c0a-451d-aa38-8ca6010dd5bf": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object {
|
||||
"columnOrder": Array [
|
||||
"49a42fe6-ebe8-4adb-8eed-1966a5297b7e",
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
],
|
||||
"columns": Object {
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"success\\" ",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": "Succ.",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"49a42fe6-ebe8-4adb-8eed-1966a5297b7e": Object {
|
||||
"dataType": "date",
|
||||
"isBucketed": true,
|
||||
"label": "@timestamp",
|
||||
"operationType": "date_histogram",
|
||||
"params": Object {
|
||||
"interval": "auto",
|
||||
},
|
||||
"scale": "interval",
|
||||
"sourceField": "@timestamp",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"indexRefName": "filter-index-pattern-0",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"event.category": "authentication",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
],
|
||||
"layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "49a42fe6-ebe8-4adb-8eed-1966a5297b7e",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#54b399",
|
||||
"forAccessor": "0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
},
|
||||
],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"2b27c80e-a20d-46f1-8fb2-79626ef4563c",
|
||||
],
|
||||
"layerId": "31213ae3-905b-4e88-b987-0cccb1f3209f",
|
||||
"layerType": "data",
|
||||
"seriesType": "area",
|
||||
"xAccessor": "33a6163d-0c0a-451d-aa38-8ca6010dd5bf",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#e7664c",
|
||||
"forAccessor": "2b27c80e-a20d-46f1-8fb2-79626ef4563c",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "area",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Host] User authentications - area ",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,240 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUserAuthenticationsBarLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-31213ae3-905b-4e88-b987-0cccb1f3209f",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-b9acd453-f476-4467-ad38-203e37b73e55",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"31213ae3-905b-4e88-b987-0cccb1f3209f": Object {
|
||||
"columnOrder": Array [
|
||||
"430e690c-9992-414f-9bce-00812d99a5e7",
|
||||
"938b445a-a291-4bbc-84fe-4f47b69c20e4",
|
||||
],
|
||||
"columns": Object {
|
||||
"430e690c-9992-414f-9bce-00812d99a5e7": Object {
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Filters",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"success\\" ",
|
||||
},
|
||||
"label": "Succ.",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
"938b445a-a291-4bbc-84fe-4f47b69c20e4": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Succ.",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
"b9acd453-f476-4467-ad38-203e37b73e55": Object {
|
||||
"columnOrder": Array [
|
||||
"e959c351-a3a2-4525-b244-9623f215a8fd",
|
||||
"c8165fc3-7180-4f1b-8c87-bc3ea04c6df7",
|
||||
],
|
||||
"columns": Object {
|
||||
"c8165fc3-7180-4f1b-8c87-bc3ea04c6df7": Object {
|
||||
"dataType": "number",
|
||||
"isBucketed": false,
|
||||
"label": "Fail",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
"e959c351-a3a2-4525-b244-9623f215a8fd": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "string",
|
||||
"isBucketed": true,
|
||||
"label": "Fail",
|
||||
"operationType": "filters",
|
||||
"params": Object {
|
||||
"filters": Array [
|
||||
Object {
|
||||
"input": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome:\\"failure\\" ",
|
||||
},
|
||||
"label": "Fail",
|
||||
},
|
||||
],
|
||||
},
|
||||
"scale": "ordinal",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"indexRefName": "filter-index-pattern-0",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"event.category": "authentication",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"axisTitlesVisibilitySettings": Object {
|
||||
"x": false,
|
||||
"yLeft": false,
|
||||
"yRight": true,
|
||||
},
|
||||
"fittingFunction": "None",
|
||||
"gridlinesVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"labelsOrientation": Object {
|
||||
"x": 0,
|
||||
"yLeft": 0,
|
||||
"yRight": 0,
|
||||
},
|
||||
"layers": Array [
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"938b445a-a291-4bbc-84fe-4f47b69c20e4",
|
||||
],
|
||||
"layerId": "31213ae3-905b-4e88-b987-0cccb1f3209f",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"xAccessor": "430e690c-9992-414f-9bce-00812d99a5e7",
|
||||
"yConfig": Array [],
|
||||
},
|
||||
Object {
|
||||
"accessors": Array [
|
||||
"c8165fc3-7180-4f1b-8c87-bc3ea04c6df7",
|
||||
],
|
||||
"layerId": "b9acd453-f476-4467-ad38-203e37b73e55",
|
||||
"layerType": "data",
|
||||
"seriesType": "bar_horizontal_stacked",
|
||||
"xAccessor": "e959c351-a3a2-4525-b244-9623f215a8fd",
|
||||
"yConfig": Array [
|
||||
Object {
|
||||
"color": "#e7664c",
|
||||
"forAccessor": "c8165fc3-7180-4f1b-8c87-bc3ea04c6df7",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"legend": Object {
|
||||
"isVisible": false,
|
||||
"position": "right",
|
||||
"showSingleSeries": false,
|
||||
},
|
||||
"preferredSeriesType": "bar_horizontal_stacked",
|
||||
"tickLabelsVisibilitySettings": Object {
|
||||
"x": true,
|
||||
"yLeft": true,
|
||||
"yRight": true,
|
||||
},
|
||||
"valueLabels": "hide",
|
||||
"yLeftExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
"yRightExtent": Object {
|
||||
"mode": "full",
|
||||
},
|
||||
},
|
||||
},
|
||||
"title": "[Host] User authentications - bar ",
|
||||
"visualizationType": "lnsXY",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,127 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`kpiUserAuthenticationsMetricSuccessLensAttributes should render 1`] = `
|
||||
Object {
|
||||
"description": "",
|
||||
"references": Array [
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-current-indexpattern",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
Object {
|
||||
"id": "security-solution-my-test",
|
||||
"name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
"state": Object {
|
||||
"datasourceStates": Object {
|
||||
"indexpattern": Object {
|
||||
"layers": Object {
|
||||
"4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object {
|
||||
"columnOrder": Array [
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
],
|
||||
"columns": Object {
|
||||
"0eb97c09-a351-4280-97da-944e4bd30dd7": Object {
|
||||
"customLabel": true,
|
||||
"dataType": "number",
|
||||
"filter": Object {
|
||||
"language": "kuery",
|
||||
"query": "event.outcome : \\"success\\" ",
|
||||
},
|
||||
"isBucketed": false,
|
||||
"label": " ",
|
||||
"operationType": "count",
|
||||
"scale": "ratio",
|
||||
"sourceField": "___records___",
|
||||
},
|
||||
},
|
||||
"incompleteColumns": Object {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filters": Array [
|
||||
Object {
|
||||
"$state": Object {
|
||||
"store": "appState",
|
||||
},
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"indexRefName": "filter-index-pattern-0",
|
||||
"key": "query",
|
||||
"negate": false,
|
||||
"type": "custom",
|
||||
"value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"filter": Array [
|
||||
Object {
|
||||
"term": Object {
|
||||
"event.category": "authentication",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "host.id",
|
||||
"negate": false,
|
||||
"params": Object {
|
||||
"query": "123",
|
||||
},
|
||||
"type": "phrase",
|
||||
},
|
||||
"query": Object {
|
||||
"match_phrase": Object {
|
||||
"host.id": "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"meta": Object {
|
||||
"alias": null,
|
||||
"disabled": false,
|
||||
"key": "_index",
|
||||
"negate": false,
|
||||
"params": Array [
|
||||
"auditbeat-mytest-*",
|
||||
],
|
||||
"type": "phrases",
|
||||
},
|
||||
"query": Object {
|
||||
"bool": Object {
|
||||
"minimum_should_match": 1,
|
||||
"should": Array [
|
||||
Object {
|
||||
"match_phrase": Object {
|
||||
"_index": "auditbeat-mytest-*",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"query": Object {
|
||||
"language": "kql",
|
||||
"query": "host.name: *",
|
||||
},
|
||||
"visualization": Object {
|
||||
"accessor": "0eb97c09-a351-4280-97da-944e4bd30dd7",
|
||||
"layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c",
|
||||
"layerType": "data",
|
||||
},
|
||||
},
|
||||
"title": "[Host] User authentications - metric success ",
|
||||
"visualizationType": "lnsLegacyMetric",
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiTotalUsersAreaLensAttributes } from './kpi_total_users_area';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiTotalUsersAreaLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiTotalUsersAreaLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UNIQUE_COUNT } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const kpiTotalUsersAreaLensAttributes: LensAttributes = {
|
||||
|
@ -32,7 +33,7 @@ export const kpiTotalUsersAreaLensAttributes: LensAttributes = {
|
|||
customLabel: true,
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
label: ' ',
|
||||
label: UNIQUE_COUNT('user.name'),
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
sourceField: 'user.name',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiTotalUsersMetricLensAttributes } from './kpi_total_users_metric';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiTotalUsersMetricLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiTotalUsersMetricLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -19,7 +19,7 @@ export const kpiTotalUsersMetricLensAttributes: LensAttributes = {
|
|||
'3e51b035-872c-4b44-824b-fe069c222e91': {
|
||||
dataType: 'number',
|
||||
isBucketed: false,
|
||||
label: 'Unique count of user.name',
|
||||
label: ' ',
|
||||
operationType: 'unique_count',
|
||||
scale: 'ratio',
|
||||
sourceField: 'user.name',
|
||||
|
@ -39,7 +39,7 @@ export const kpiTotalUsersMetricLensAttributes: LensAttributes = {
|
|||
},
|
||||
},
|
||||
title: '[User] Users - metric',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
references: [
|
||||
{
|
||||
id: '{dataViewId}',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUserAuthenticationsMetricFailureLensAttributes } from './kpi_user_authentication_metric_failure';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUserAuthenticationsMetricFailureLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUserAuthenticationsMetricFailureLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiUserAuthenticationsMetricFailureLensAttributes: LensAttributes = {
|
||||
title: '[Host] User authentications - metric failure ',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
accessor: '0eb97c09-a351-4280-97da-944e4bd30dd7',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUserAuthenticationsAreaLensAttributes } from './kpi_user_authentications_area';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUserAuthenticationsAreaLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUserAuthenticationsAreaLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FAIL_CHART_LABEL, SUCCESS_CHART_LABEL } from '../../translations';
|
||||
import type { LensAttributes } from '../../types';
|
||||
|
||||
export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = {
|
||||
|
@ -124,7 +125,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = {
|
|||
query: 'event.outcome: "failure" ',
|
||||
},
|
||||
isBucketed: false,
|
||||
label: 'Fail',
|
||||
label: FAIL_CHART_LABEL,
|
||||
operationType: 'count',
|
||||
scale: 'ratio',
|
||||
sourceField: '___records___',
|
||||
|
@ -157,7 +158,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = {
|
|||
query: 'event.outcome : "success" ',
|
||||
},
|
||||
isBucketed: false,
|
||||
label: 'Succ.',
|
||||
label: SUCCESS_CHART_LABEL,
|
||||
operationType: 'count',
|
||||
scale: 'ratio',
|
||||
sourceField: '___records___',
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUserAuthenticationsBarLensAttributes } from './kpi_user_authentications_bar';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUserAuthenticationsBarLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUserAuthenticationsBarLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import { wrapper } from '../../mocks';
|
||||
|
||||
import { useLensAttributes } from '../../use_lens_attributes';
|
||||
|
||||
import { kpiUserAuthenticationsMetricSuccessLensAttributes } from './kpi_user_authentications_metric_success';
|
||||
|
||||
jest.mock('../../../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
selectedPatterns: ['auditbeat-mytest-*'],
|
||||
dataViewId: 'security-solution-my-test',
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('../../../../utils/route/use_route_spy', () => ({
|
||||
useRouteSpy: jest.fn().mockReturnValue([
|
||||
{
|
||||
detailName: 'mockHost',
|
||||
pageName: 'users',
|
||||
tabName: 'events',
|
||||
},
|
||||
]),
|
||||
}));
|
||||
|
||||
describe('kpiUserAuthenticationsMetricSuccessLensAttributes', () => {
|
||||
it('should render', () => {
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
lensAttributes: kpiUserAuthenticationsMetricSuccessLensAttributes,
|
||||
stackByField: 'event.dataset',
|
||||
}),
|
||||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types';
|
|||
export const kpiUserAuthenticationsMetricSuccessLensAttributes: LensAttributes = {
|
||||
title: '[Host] User authentications - metric success ',
|
||||
description: '',
|
||||
visualizationType: 'lnsMetric',
|
||||
visualizationType: 'lnsLegacyMetric',
|
||||
state: {
|
||||
visualization: {
|
||||
accessor: '0eb97c09-a351-4280-97da-944e4bd30dd7',
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { cloneDeep } from 'lodash/fp';
|
||||
|
||||
import {
|
||||
TestProviders,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
} from '../../mock';
|
||||
import type { State } from '../../store';
|
||||
import { createStore } from '../../store';
|
||||
|
||||
export const queryFromSearchBar = {
|
||||
query: 'host.name: *',
|
||||
language: 'kql',
|
||||
};
|
||||
|
||||
export const filterFromSearchBar = [
|
||||
{
|
||||
meta: {
|
||||
alias: null,
|
||||
negate: false,
|
||||
disabled: false,
|
||||
type: 'phrase',
|
||||
key: 'host.id',
|
||||
params: {
|
||||
query: '123',
|
||||
},
|
||||
},
|
||||
query: {
|
||||
match_phrase: {
|
||||
'host.id': '123',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const mockCreateStoreWithQueryFilters = () => {
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
|
||||
const state: State = mockGlobalState;
|
||||
|
||||
const myState = cloneDeep(state);
|
||||
|
||||
myState.inputs = {
|
||||
...myState.inputs,
|
||||
global: {
|
||||
...myState.inputs.global,
|
||||
query: queryFromSearchBar,
|
||||
filters: filterFromSearchBar,
|
||||
},
|
||||
};
|
||||
return createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
};
|
||||
|
||||
export const wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
<TestProviders store={mockCreateStoreWithQueryFilters()}>{children}</TestProviders>
|
||||
);
|
|
@ -67,9 +67,41 @@ export const SUCCESS_CHART_LABEL = i18n.translate(
|
|||
}
|
||||
);
|
||||
|
||||
export const AUTHENCICATION_SUCCESS_CHART_LABEL = i18n.translate(
|
||||
'xpack.securitySolution.visualizationActions.userAuthentications.authentication.successChartLabel',
|
||||
{
|
||||
defaultMessage: 'Success',
|
||||
}
|
||||
);
|
||||
|
||||
export const FAIL_CHART_LABEL = i18n.translate(
|
||||
'xpack.securitySolution.visualizationActions.userAuthentications.failChartLabel',
|
||||
{
|
||||
defaultMessage: 'Fail',
|
||||
}
|
||||
);
|
||||
|
||||
export const AUTHENCICATION_FAILURE_CHART_LABEL = i18n.translate(
|
||||
'xpack.securitySolution.visualizationActions.userAuthentications.authentication.failureChartLabel',
|
||||
{
|
||||
defaultMessage: 'Failure',
|
||||
}
|
||||
);
|
||||
|
||||
export const UNIQUE_COUNT = (field: string) =>
|
||||
i18n.translate('xpack.securitySolution.visualizationActions.uniqueCountLabel', {
|
||||
values: { field },
|
||||
|
||||
defaultMessage: 'Unique count of {field}',
|
||||
});
|
||||
|
||||
export const TOP_VALUE = (field: string) =>
|
||||
i18n.translate('xpack.securitySolution.visualizationActions.topValueLabel', {
|
||||
values: { field },
|
||||
|
||||
defaultMessage: 'Top values of {field}',
|
||||
});
|
||||
|
||||
export const COUNT = i18n.translate('xpack.securitySolution.visualizationActions.countLabel', {
|
||||
defaultMessage: 'Count of records',
|
||||
});
|
||||
|
|
|
@ -6,21 +6,12 @@
|
|||
*/
|
||||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
import React from 'react';
|
||||
import { cloneDeep } from 'lodash/fp';
|
||||
|
||||
import {
|
||||
TestProviders,
|
||||
mockGlobalState,
|
||||
SUB_PLUGINS_REDUCER,
|
||||
kibanaObservable,
|
||||
createSecuritySolutionStorageMock,
|
||||
} from '../../mock';
|
||||
import { getExternalAlertLensAttributes } from './lens_attributes/common/external_alert';
|
||||
import { useLensAttributes } from './use_lens_attributes';
|
||||
import { hostNameExistsFilter, getHostDetailsPageFilter, getIndexFilters } from './utils';
|
||||
import type { State } from '../../store';
|
||||
import { createStore } from '../../store';
|
||||
|
||||
import { filterFromSearchBar, queryFromSearchBar, wrapper } from './mocks';
|
||||
|
||||
jest.mock('../../containers/sourcerer', () => ({
|
||||
useSourcererDataView: jest.fn().mockReturnValue({
|
||||
|
@ -40,51 +31,7 @@ jest.mock('../../utils/route/use_route_spy', () => ({
|
|||
}));
|
||||
|
||||
describe('useLensAttributes', () => {
|
||||
const state: State = mockGlobalState;
|
||||
const { storage } = createSecuritySolutionStorageMock();
|
||||
const queryFromSearchBar = {
|
||||
query: 'host.name: *',
|
||||
language: 'kql',
|
||||
};
|
||||
|
||||
const filterFromSearchBar = [
|
||||
{
|
||||
meta: {
|
||||
alias: null,
|
||||
negate: false,
|
||||
disabled: false,
|
||||
type: 'phrase',
|
||||
key: 'host.id',
|
||||
params: {
|
||||
query: '123',
|
||||
},
|
||||
},
|
||||
query: {
|
||||
match_phrase: {
|
||||
'host.id': '123',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
|
||||
beforeEach(() => {
|
||||
const myState = cloneDeep(state);
|
||||
myState.inputs = {
|
||||
...myState.inputs,
|
||||
global: {
|
||||
...myState.inputs.global,
|
||||
query: queryFromSearchBar,
|
||||
filters: filterFromSearchBar,
|
||||
},
|
||||
};
|
||||
store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
});
|
||||
|
||||
it('should add query', () => {
|
||||
const wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
<TestProviders store={store}>{children}</TestProviders>
|
||||
);
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
|
@ -94,13 +41,10 @@ describe('useLensAttributes', () => {
|
|||
{ wrapper }
|
||||
);
|
||||
|
||||
expect(result?.current?.state.query).toEqual({ query: 'host.name: *', language: 'kql' });
|
||||
expect(result?.current?.state.query).toEqual(queryFromSearchBar);
|
||||
});
|
||||
|
||||
it('should add filters', () => {
|
||||
const wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
<TestProviders store={store}>{children}</TestProviders>
|
||||
);
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
|
@ -120,9 +64,6 @@ describe('useLensAttributes', () => {
|
|||
});
|
||||
|
||||
it('should add data view id to references', () => {
|
||||
const wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
<TestProviders store={store}>{children}</TestProviders>
|
||||
);
|
||||
const { result } = renderHook(
|
||||
() =>
|
||||
useLensAttributes({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue