From d1b861704bb4b55a7db0119e82d4802a39cceb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Fri, 29 Nov 2019 11:28:42 +0100 Subject: [PATCH 01/16] Add ml module for categorization and count --- .../modules/logs_ui_categorization/logo.json | 3 ++ .../logs_ui_categorization/manifest.json | 20 +++++++++++ ...tafeed_log_entry_categorization_count.json | 15 ++++++++ .../ml/log_entry_categorization_count.json | 34 +++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json create mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json create mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json create mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json new file mode 100644 index 0000000000000..26b404ff331c6 --- /dev/null +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json @@ -0,0 +1,3 @@ +{ + "icon": "logsApp" +} diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json new file mode 100644 index 0000000000000..543ea8ecec464 --- /dev/null +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json @@ -0,0 +1,20 @@ +{ + "id": "logs_ui_categorization", + "title": "Log entry categorization", + "description": "Categorize log entries in the Logs UI", + "type": "Logs", + "logoFile": "logo.json", + "jobs": [ + { + "id": "log-entry-categorization-count", + "file": "log_entry_categorization_count.json" + } + ], + "datafeeds": [ + { + "id": "datafeed-log-entry-categorization-count", + "file": "datafeed_log_entry_categorization_count.json", + "job_id": "log-entry-categorization-count" + } + ] +} diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json new file mode 100644 index 0000000000000..6e117b4de87ea --- /dev/null +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json @@ -0,0 +1,15 @@ +{ + "job_id": "JOB_ID", + "indices": ["INDEX_PATTERN_NAME"], + "query": { + "bool": { + "filter": [ + { + "exists": { + "field": "message" + } + } + ] + } + } +} diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json new file mode 100644 index 0000000000000..532fac4f40784 --- /dev/null +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json @@ -0,0 +1,34 @@ +{ + "job_type": "anomaly_detector", + "description": "Categorize log entries and detect count anomalies", + "groups": ["logs-ui"], + "analysis_config": { + "bucket_span": "15m", + "categorization_field_name": "message", + "detectors": [ + { + "by_field_name": "mlcategory", + "detector_description": "count by mlcategory", + "function": "count", + "partition_field_name": "event.dataset", + "use_null": true + } + ], + "influencers": ["event.dataset", "mlcategory"] + }, + "analysis_limits": { + "model_memory_limit": "10mb", + "categorization_examples_limit": 1 + }, + "data_description": { + "time_field": "@timestamp", + "time_format": "epoch_ms" + }, + "model_plot_config": { + "enabled": true + }, + "custom_settings": { + "created_by": "ml-module-logs-ui-categorization", + "job_revision": 0 + } +} From 7c3960ae689bc737585663ef6509cd54444f3ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Fri, 29 Nov 2019 12:20:55 +0100 Subject: [PATCH 02/16] Move common setup status components to shared directory --- .../logging/log_analysis_setup/index.ts | 8 ++++++++ .../log_analysis_setup/ml_unavailable_prompt.tsx} | 15 ++++++++------- .../setup_status_unknown_prompt.tsx} | 6 +++--- .../pages/logs/log_entry_rate/page_content.tsx | 10 ++++++---- 4 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/page_unavailable_content.tsx => components/logging/log_analysis_setup/ml_unavailable_prompt.tsx} (73%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/page_setup_status_unknown.tsx => components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx} (79%) diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts new file mode 100644 index 0000000000000..6967129e454c3 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './ml_unavailable_prompt'; +export * from './setup_status_unknown_prompt'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_unavailable_content.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx similarity index 73% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_unavailable_content.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx index c77e5d408fe5f..63e1bb23a2d82 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_unavailable_content.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx @@ -4,26 +4,27 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import { EuiButton, EuiEmptyPrompt, EuiLink } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiEmptyPrompt, EuiLink, EuiButton } from '@elastic/eui'; +import React from 'react'; + import euiStyled from '../../../../../../common/eui_styled_components'; -export const LogEntryRateUnavailableContent: React.FunctionComponent<{}> = () => ( +export const MlUnavailablePrompt: React.FunctionComponent<{}> = () => ( } body={

= () => } actions={ - {i18n.translate('xpack.infra.logs.analysisPage.unavailable.mlAppButton', { + {i18n.translate('xpack.infra.logs.analysis.mlAppButton', { defaultMessage: 'Open Machine Learning', })} diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_status_unknown.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx similarity index 79% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_status_unknown.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx index 4c685bd42b937..f65ff6a1eec78 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_status_unknown.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx @@ -14,21 +14,21 @@ interface Props { retry: () => void; } -export const LogEntryRateSetupStatusUnknownContent: React.FunctionComponent = ({ +export const LogAnalysisSetupStatusUnknownPrompt: React.FunctionComponent = ({ retry, }: Props) => ( } actions={ retry()} color="primary" fill> - {i18n.translate('xpack.infra.logs.analysisPage.setupStatusUnknown.tryAgainButton', { + {i18n.translate('xpack.infra.logs.analysis.setupStatusTryAgainButton', { defaultMessage: 'Try again', })} diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx index e71985f73fbb8..c41573f6ae8ea 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx @@ -9,12 +9,14 @@ import React, { useContext, useEffect } from 'react'; import { isSetupStatusWithResults } from '../../../../common/log_analysis'; import { LoadingPage } from '../../../components/loading_page'; +import { + LogAnalysisSetupStatusUnknownPrompt, + MlUnavailablePrompt, +} from '../../../components/logging/log_analysis_setup'; import { LogAnalysisCapabilities } from '../../../containers/logs/log_analysis'; import { Source } from '../../../containers/source'; import { LogEntryRateResultsContent } from './page_results_content'; import { LogEntryRateSetupContent } from './page_setup_content'; -import { LogEntryRateUnavailableContent } from './page_unavailable_content'; -import { LogEntryRateSetupStatusUnknownContent } from './page_setup_status_unknown'; import { useLogEntryRateModuleContext } from './use_log_entry_rate_module'; export const LogEntryRatePageContent = () => { @@ -39,7 +41,7 @@ export const LogEntryRatePageContent = () => { }, [fetchJobStatus, fetchModuleDefinition]); if (!hasLogAnalysisCapabilites) { - return ; + return ; } else if (setupStatus === 'initializing') { return ( { /> ); } else if (setupStatus === 'unknown') { - return ; + return ; } else if (isSetupStatusWithResults(setupStatus)) { return ( Date: Fri, 29 Nov 2019 12:23:35 +0100 Subject: [PATCH 03/16] Add categorization tab --- .../common/log_analysis/job_parameters.ts | 2 + .../plugins/infra/public/pages/logs/index.tsx | 21 +++- .../logs/log_entry_categorization/index.ts | 7 ++ .../module_descriptor.ts | 116 ++++++++++++++++++ .../logs/log_entry_categorization/page.tsx | 21 ++++ .../log_entry_categorization/page_content.tsx | 77 ++++++++++++ .../page_providers.tsx | 27 ++++ .../use_log_entry_categorization_module.tsx | 46 +++++++ 8 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/index.ts create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/module_descriptor.ts create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_providers.tsx create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts b/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts index 626e90b65a7d8..e89ed609883db 100644 --- a/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts +++ b/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts @@ -8,6 +8,8 @@ import * as rt from 'io-ts'; export const bucketSpan = 900000; +export const categorizationMessageField = 'message'; + export const partitionField = 'event.dataset'; export const getJobIdPrefix = (spaceId: string, sourceId: string) => diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx index 4eddecf732f75..7eb91f4ba186d 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx @@ -53,6 +53,16 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag path: `${match.path}/log-rate`, }; + const logCategorizationTab = { + title: ( + <> + {logCategorizationTabTitle} + + + ), + path: `${match.path}/log-categorization`, + }; + const settingsTab = { title: settingsTabTitle, path: `${match.path}/settings`, @@ -90,7 +100,7 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag @@ -122,10 +132,17 @@ const streamTabTitle = i18n.translate('xpack.infra.logs.index.streamTabTitle', { defaultMessage: 'Stream', }); -const logRateTabTitle = i18n.translate('xpack.infra.logs.index.analysisBetaBadgeTitle', { +const logRateTabTitle = i18n.translate('xpack.infra.logs.index.logRateBetaBadgeTitle', { defaultMessage: 'Log Rate', }); +const logCategorizationTabTitle = i18n.translate( + 'xpack.infra.logs.index.logCategorizationBetaBadgeTitle', + { + defaultMessage: 'Categories', + } +); + const settingsTabTitle = i18n.translate('xpack.infra.logs.index.settingsTabTitle', { defaultMessage: 'Settings', }); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/index.ts b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/index.ts new file mode 100644 index 0000000000000..224217e860e94 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './page'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/module_descriptor.ts b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/module_descriptor.ts new file mode 100644 index 0000000000000..ca18be388a50f --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/module_descriptor.ts @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + bucketSpan, + categorizationMessageField, + getJobId, + partitionField, +} from '../../../../common/log_analysis'; + +import { + ModuleDescriptor, + ModuleSourceConfiguration, + cleanUpJobsAndDatafeeds, +} from '../../../containers/logs/log_analysis'; +import { callJobsSummaryAPI } from '../../../containers/logs/log_analysis/api/ml_get_jobs_summary_api'; +import { callGetMlModuleAPI } from '../../../containers/logs/log_analysis/api/ml_get_module'; +import { callSetupMlModuleAPI } from '../../../containers/logs/log_analysis/api/ml_setup_module_api'; +import { callValidateIndicesAPI } from '../../../containers/logs/log_analysis/api/validate_indices'; + +const jobTypes = ['log-entry-categorization-count']; +const moduleId = 'logs_ui_categorization'; + +type JobType = typeof jobTypes[0]; + +const getJobIds = (spaceId: string, sourceId: string) => + jobTypes.reduce( + (accumulatedJobIds, jobType) => ({ + ...accumulatedJobIds, + [jobType]: getJobId(spaceId, sourceId, jobType), + }), + {} as Record + ); + +const getJobSummary = async (spaceId: string, sourceId: string) => { + const response = await callJobsSummaryAPI(spaceId, sourceId, jobTypes); + const jobIds = Object.values(getJobIds(spaceId, sourceId)); + + return response.filter(jobSummary => jobIds.includes(jobSummary.id)); +}; + +const getModuleDefinition = async () => { + return await callGetMlModuleAPI(moduleId); +}; + +const setUpModule = async ( + start: number | undefined, + end: number | undefined, + { spaceId, sourceId, indices, timestampField }: ModuleSourceConfiguration +) => { + const indexNamePattern = indices.join(','); + const jobOverrides = [ + { + job_id: 'log-entry-categorization-count' as const, + analysis_config: { + bucket_span: `${bucketSpan}ms`, + }, + data_description: { + time_field: timestampField, + }, + custom_settings: { + logs_source_config: { + indexPattern: indexNamePattern, + timestampField, + bucketSpan, + }, + }, + }, + ]; + + return callSetupMlModuleAPI( + moduleId, + start, + end, + spaceId, + sourceId, + indexNamePattern, + jobOverrides + ); +}; + +const cleanUpModule = async (spaceId: string, sourceId: string) => { + return await cleanUpJobsAndDatafeeds(spaceId, sourceId, jobTypes); +}; + +const validateSetupIndices = async ({ indices, timestampField }: ModuleSourceConfiguration) => { + return await callValidateIndicesAPI(indices, [ + { + name: timestampField, + validTypes: ['date'], + }, + { + name: partitionField, + validTypes: ['keyword'], + }, + { + name: categorizationMessageField, + validTypes: ['text'], + }, + ]); +}; + +export const logEntryCategorizationModule: ModuleDescriptor = { + moduleId, + jobTypes, + bucketSpan, + getJobIds, + getJobSummary, + getModuleDefinition, + setUpModule, + cleanUpModule, + validateSetupIndices, +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx new file mode 100644 index 0000000000000..3c7ceec349451 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { ColumnarPage } from '../../../components/page'; +// import { LogEntryCategorizationPageContent } from './page_content'; +import { LogEntryCategorizationPageProviders } from './page_providers'; + +export const LogEntryCategorizationPageProvidersPage = () => { + return ( + + + {/* */} + + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx new file mode 100644 index 0000000000000..943f890cc3016 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import React, { useContext, useEffect } from 'react'; + +import { isSetupStatusWithResults } from '../../../../common/log_analysis'; +import { LoadingPage } from '../../../components/loading_page'; +import { + LogAnalysisSetupStatusUnknownPrompt, + MlUnavailablePrompt, +} from '../../../components/logging/log_analysis_setup'; +import { LogAnalysisCapabilities } from '../../../containers/logs/log_analysis'; +// import { Source } from '../../../containers/source'; +// import { LogEntryCategorizationResultsContent } from './page_results_content'; +// import { LogEntryCategorizationSetupContent } from './page_setup_content'; +import { useLogEntryCategorizationModuleContext } from './use_log_entry_categorization_module'; + +export const LogEntryCategorizationPageContent = () => { + // const { sourceId } = useContext(Source.Context); + const { hasLogAnalysisCapabilites } = useContext(LogAnalysisCapabilities.Context); + + const { + // cleanUpAndSetUpModule: cleanupAndSetup, + fetchJobStatus, + fetchModuleDefinition, + // lastSetupErrorMessages, + // moduleDescriptor, + // setUpModule, + setupStatus, + // sourceConfiguration, + // viewResults, + } = useLogEntryCategorizationModuleContext(); + + useEffect(() => { + fetchModuleDefinition(); + fetchJobStatus(); + }, []); + + if (!hasLogAnalysisCapabilites) { + return ; + } else if (setupStatus === 'initializing') { + return ( + + ); + } else if (setupStatus === 'unknown') { + return ; + } else if (isSetupStatusWithResults(setupStatus)) { + return null; + // return ( + // + // ); + } else { + return null; + // return ( + // + // ); + } +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_providers.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_providers.tsx new file mode 100644 index 0000000000000..6a8dc6c402175 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_providers.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { useSourceContext } from '../../../containers/source'; +import { useKibanaSpaceId } from '../../../utils/use_kibana_space_id'; +import { LogEntryCategorizationModuleProvider } from './use_log_entry_categorization_module'; + +export const LogEntryCategorizationPageProviders: React.FunctionComponent = ({ children }) => { + const { sourceId, source } = useSourceContext(); + const spaceId = useKibanaSpaceId(); + + return ( + + {children} + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx new file mode 100644 index 0000000000000..b3f2a0b5ae6b5 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import createContainer from 'constate'; +import { useMemo } from 'react'; + +import { + useLogAnalysisModule, + ModuleSourceConfiguration, +} from '../../../containers/logs/log_analysis'; +import { logEntryCategorizationModule } from './module_descriptor'; + +export const useLogEntryCategorizationModule = ({ + indexPattern, + sourceId, + spaceId, + timestampField, +}: { + indexPattern: string; + sourceId: string; + spaceId: string; + timestampField: string; +}) => { + const sourceConfiguration: ModuleSourceConfiguration = useMemo( + () => ({ + indices: indexPattern.split(','), + sourceId, + spaceId, + timestampField, + }), + [indexPattern] + ); + + return useLogAnalysisModule({ + moduleDescriptor: logEntryCategorizationModule, + sourceConfiguration, + }); +}; + +export const [ + LogEntryCategorizationModuleProvider, + useLogEntryCategorizationModuleContext, +] = createContainer(useLogEntryCategorizationModule); From 4a54e6822428de926be3bf2bb3a0651487a81f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Fri, 29 Nov 2019 12:33:34 +0100 Subject: [PATCH 04/16] Rename categorization to categories --- .../common/log_analysis/job_parameters.ts | 2 +- .../plugins/infra/public/pages/logs/index.tsx | 20 ++++++++---------- .../index.ts | 0 .../module_descriptor.ts | 12 +++++------ .../pages/logs/log_entry_categories/page.tsx | 21 +++++++++++++++++++ .../page_content.tsx | 14 ++++++------- .../page_providers.tsx | 8 +++---- .../use_log_entry_categories_module.tsx} | 12 +++++------ .../logs/log_entry_categorization/page.tsx | 21 ------------------- .../logo.json | 0 .../modules/logs_ui_categories/manifest.json | 20 ++++++++++++++++++ .../datafeed_log_entry_categories_count.json} | 0 .../ml/log_entry_categories_count.json} | 2 +- .../logs_ui_categorization/manifest.json | 20 ------------------ 14 files changed, 75 insertions(+), 77 deletions(-) rename x-pack/legacy/plugins/infra/public/pages/logs/{log_entry_categorization => log_entry_categories}/index.ts (100%) rename x-pack/legacy/plugins/infra/public/pages/logs/{log_entry_categorization => log_entry_categories}/module_descriptor.ts (90%) create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx rename x-pack/legacy/plugins/infra/public/pages/logs/{log_entry_categorization => log_entry_categories}/page_content.tsx (83%) rename x-pack/legacy/plugins/infra/public/pages/logs/{log_entry_categorization => log_entry_categories}/page_providers.tsx (72%) rename x-pack/legacy/plugins/infra/public/pages/logs/{log_entry_categorization/use_log_entry_categorization_module.tsx => log_entry_categories/use_log_entry_categories_module.tsx} (74%) delete mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx rename x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/{logs_ui_categorization => logs_ui_categories}/logo.json (100%) create mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json rename x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/{logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json => logs_ui_categories/ml/datafeed_log_entry_categories_count.json} (100%) rename x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/{logs_ui_categorization/ml/log_entry_categorization_count.json => logs_ui_categories/ml/log_entry_categories_count.json} (93%) delete mode 100644 x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts b/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts index e89ed609883db..8c08e24d8665d 100644 --- a/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts +++ b/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts @@ -8,7 +8,7 @@ import * as rt from 'io-ts'; export const bucketSpan = 900000; -export const categorizationMessageField = 'message'; +export const categoriesMessageField = 'message'; export const partitionField = 'event.dataset'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx index 7eb91f4ba186d..166dfca555adf 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx @@ -53,14 +53,14 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag path: `${match.path}/log-rate`, }; - const logCategorizationTab = { + const logCategoriesTab = { title: ( <> - {logCategorizationTabTitle} - + {logCategoriesTabTitle} + ), - path: `${match.path}/log-categorization`, + path: `${match.path}/log-categories`, }; const settingsTab = { @@ -100,7 +100,7 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag @@ -109,6 +109,7 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag + = { +export const logEntryCategoriesModule: ModuleDescriptor = { moduleId, jobTypes, bucketSpan, diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx new file mode 100644 index 0000000000000..80449c84aff46 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { ColumnarPage } from '../../../components/page'; +// import { LogEntryCategoriesPageContent } from './page_content'; +import { LogEntryCategoriesPageProviders } from './page_providers'; + +export const LogEntryCategoriesPageProvidersPage = () => { + return ( + + + {/* */} + + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx similarity index 83% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx rename to x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx index 943f890cc3016..176af0f3170fa 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx @@ -15,11 +15,11 @@ import { } from '../../../components/logging/log_analysis_setup'; import { LogAnalysisCapabilities } from '../../../containers/logs/log_analysis'; // import { Source } from '../../../containers/source'; -// import { LogEntryCategorizationResultsContent } from './page_results_content'; -// import { LogEntryCategorizationSetupContent } from './page_setup_content'; -import { useLogEntryCategorizationModuleContext } from './use_log_entry_categorization_module'; +// import { LogEntryCategoriesResultsContent } from './page_results_content'; +// import { LogEntryCategoriesSetupContent } from './page_setup_content'; +import { useLogEntryCategoriesModuleContext } from './use_log_entry_categories_module'; -export const LogEntryCategorizationPageContent = () => { +export const LogEntryCategoriesPageContent = () => { // const { sourceId } = useContext(Source.Context); const { hasLogAnalysisCapabilites } = useContext(LogAnalysisCapabilities.Context); @@ -33,7 +33,7 @@ export const LogEntryCategorizationPageContent = () => { setupStatus, // sourceConfiguration, // viewResults, - } = useLogEntryCategorizationModuleContext(); + } = useLogEntryCategoriesModuleContext(); useEffect(() => { fetchModuleDefinition(); @@ -55,7 +55,7 @@ export const LogEntryCategorizationPageContent = () => { } else if (isSetupStatusWithResults(setupStatus)) { return null; // return ( - // @@ -63,7 +63,7 @@ export const LogEntryCategorizationPageContent = () => { } else { return null; // return ( - // { +export const LogEntryCategoriesPageProviders: React.FunctionComponent = ({ children }) => { const { sourceId, source } = useSourceContext(); const spaceId = useKibanaSpaceId(); return ( - {children} - + ); }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx similarity index 74% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx rename to x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx index b3f2a0b5ae6b5..363ff080142d8 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/use_log_entry_categorization_module.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx @@ -11,9 +11,9 @@ import { useLogAnalysisModule, ModuleSourceConfiguration, } from '../../../containers/logs/log_analysis'; -import { logEntryCategorizationModule } from './module_descriptor'; +import { logEntryCategoriesModule } from './module_descriptor'; -export const useLogEntryCategorizationModule = ({ +export const useLogEntryCategoriesModule = ({ indexPattern, sourceId, spaceId, @@ -35,12 +35,12 @@ export const useLogEntryCategorizationModule = ({ ); return useLogAnalysisModule({ - moduleDescriptor: logEntryCategorizationModule, + moduleDescriptor: logEntryCategoriesModule, sourceConfiguration, }); }; export const [ - LogEntryCategorizationModuleProvider, - useLogEntryCategorizationModuleContext, -] = createContainer(useLogEntryCategorizationModule); + LogEntryCategoriesModuleProvider, + useLogEntryCategoriesModuleContext, +] = createContainer(useLogEntryCategoriesModule); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx deleted file mode 100644 index 3c7ceec349451..0000000000000 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categorization/page.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; - -import { ColumnarPage } from '../../../components/page'; -// import { LogEntryCategorizationPageContent } from './page_content'; -import { LogEntryCategorizationPageProviders } from './page_providers'; - -export const LogEntryCategorizationPageProvidersPage = () => { - return ( - - - {/* */} - - - ); -}; diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/logo.json similarity index 100% rename from x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/logo.json rename to x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/logo.json diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json new file mode 100644 index 0000000000000..92d7671e3cfbf --- /dev/null +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json @@ -0,0 +1,20 @@ +{ + "id": "logs_ui_categories", + "title": "Log entry categories", + "description": "Categorize log entries in the Logs UI", + "type": "Logs", + "logoFile": "logo.json", + "jobs": [ + { + "id": "log-entry-categories-count", + "file": "log_entry_categories_count.json" + } + ], + "datafeeds": [ + { + "id": "datafeed-log-entry-categories-count", + "file": "datafeed_log_entry_categories_count.json", + "job_id": "log-entry-categories-count" + } + ] +} diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/datafeed_log_entry_categories_count.json similarity index 100% rename from x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/datafeed_log_entry_categorization_count.json rename to x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/datafeed_log_entry_categories_count.json diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json similarity index 93% rename from x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json rename to x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json index 532fac4f40784..bd57c495ea8f3 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/ml/log_entry_categorization_count.json +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json @@ -28,7 +28,7 @@ "enabled": true }, "custom_settings": { - "created_by": "ml-module-logs-ui-categorization", + "created_by": "ml-module-logs-ui-categories", "job_revision": 0 } } diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json deleted file mode 100644 index 543ea8ecec464..0000000000000 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categorization/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id": "logs_ui_categorization", - "title": "Log entry categorization", - "description": "Categorize log entries in the Logs UI", - "type": "Logs", - "logoFile": "logo.json", - "jobs": [ - { - "id": "log-entry-categorization-count", - "file": "log_entry_categorization_count.json" - } - ], - "datafeeds": [ - { - "id": "datafeed-log-entry-categorization-count", - "file": "datafeed_log_entry_categorization_count.json", - "job_id": "log-entry-categorization-count" - } - ] -} From 0100fd48c4546754e2ed96b870a234f8b221c1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Wed, 11 Dec 2019 18:49:53 +0100 Subject: [PATCH 05/16] Move setup steps to shared components directory --- .../logging/log_analysis_setup/index.ts | 5 + .../analysis_setup_indices_form.tsx | 18 +-- .../analysis_setup_timerange_form.tsx | 12 +- .../initial_configuration_step/index.ts | 1 + .../initial_configuration_step.tsx | 20 ++- .../initial_configuration_step/validation.tsx | 26 ++++ .../process_step/create_ml_jobs_button.tsx | 0 .../log_analysis_setup}/process_step/index.ts | 0 .../process_step/process_step.tsx | 20 ++- .../process_step/recreate_ml_jobs_button.tsx | 0 .../logging/log_analysis_setup/setup_page.tsx | 59 ++++++++ .../containers/logs/log_analysis/index.ts | 1 + .../log_analysis/log_analysis_setup_state.tsx | 24 +--- .../logs/log_entry_rate/page_content.tsx | 33 +---- .../log_entry_rate/page_results_content.tsx | 27 ++-- .../log_entry_rate/page_setup_content.tsx | 132 ++++++------------ .../sections/anomalies/index.tsx | 6 + .../logs/log_entry_rate/setup/setup_steps.tsx | 69 ++++----- 18 files changed, 232 insertions(+), 221 deletions(-) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/initial_configuration_step/analysis_setup_indices_form.tsx (91%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/initial_configuration_step/analysis_setup_timerange_form.tsx (94%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/initial_configuration_step/index.ts (90%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/initial_configuration_step/initial_configuration_step.tsx (85%) create mode 100644 x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/process_step/create_ml_jobs_button.tsx (100%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/process_step/index.ts (100%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/process_step/process_step.tsx (83%) rename x-pack/legacy/plugins/infra/public/{pages/logs/log_entry_rate/setup => components/logging/log_analysis_setup}/process_step/recreate_ml_jobs_button.tsx (100%) create mode 100644 x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_page.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts index 6967129e454c3..c7a49a90a7886 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts @@ -4,5 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +export * from './setup_page'; + +export * from './initial_configuration_step'; +export * from './process_step'; + export * from './ml_unavailable_prompt'; export * from './setup_status_unknown_prompt'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/initial_configuration_step/analysis_setup_indices_form.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/initial_configuration_step/analysis_setup_indices_form.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx index 5a4c21670191e..6d7b694423e0a 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/initial_configuration_step/analysis_setup_indices_form.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx @@ -8,11 +8,9 @@ import { EuiCode, EuiDescribedFormGroup, EuiFormRow, EuiCheckbox, EuiToolTip } f import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useCallback, useMemo } from 'react'; -import { - ValidatedIndex, - ValidationIndicesUIError, -} from '../../../../../containers/logs/log_analysis/log_analysis_setup_state'; -import { LoadingOverlayWrapper } from '../../../../../components/loading_overlay_wrapper'; + +import { LoadingOverlayWrapper } from '../../../loading_overlay_wrapper'; +import { ValidatedIndex, ValidationIndicesUIError } from './validation'; export const AnalysisSetupIndicesForm: React.FunctionComponent<{ indices: ValidatedIndex[]; @@ -61,12 +59,10 @@ export const AnalysisSetupIndicesForm: React.FunctionComponent<{ - - + } description={ - - + } description={ void; @@ -27,6 +25,13 @@ interface InitialConfigurationStepProps { validationErrors?: ValidationIndicesUIError[]; } +export const createInitialConfigurationStep = ( + props: InitialConfigurationStepProps +): EuiContainedStepProps => ({ + title: initialConfigurationStepTitle, + children: , +}); + export const InitialConfigurationStep: React.FunctionComponent = ({ setStartTime, setEndTime, @@ -67,6 +72,13 @@ const errorCalloutTitle = i18n.translate( } ); +const initialConfigurationStepTitle = i18n.translate( + 'xpack.infra.analysisSetup.configurationStepTitle', + { + defaultMessage: 'Configuration', + } +); + const ValidationErrors: React.FC<{ errors: ValidationIndicesUIError[] }> = ({ errors }) => { if (errors.length === 0) { return null; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx new file mode 100644 index 0000000000000..8b733f66ef4a8 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ValidationIndicesError } from '../../../../../common/http_api'; + +export type ValidationIndicesUIError = + | ValidationIndicesError + | { error: 'NETWORK_ERROR' } + | { error: 'TOO_FEW_SELECTED_INDICES' }; + +interface ValidIndex { + validity: 'valid'; + name: string; + isSelected: boolean; +} + +interface InvalidIndex { + validity: 'invalid'; + name: string; + errors: ValidationIndicesError[]; +} + +export type ValidatedIndex = ValidIndex | InvalidIndex; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/create_ml_jobs_button.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/create_ml_jobs_button.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/create_ml_jobs_button.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/create_ml_jobs_button.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/index.ts b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/index.ts rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/process_step.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx similarity index 83% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/process_step.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx index 978e45e26b733..f3ccba9e247ff 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/process_step.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx @@ -14,11 +14,12 @@ import { EuiCallOut, EuiCode, } from '@elastic/eui'; +import { EuiContainedStepProps } from '@elastic/eui/src/components/steps/steps'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { SetupStatus } from '../../../../../../common/log_analysis'; +import { SetupStatus } from '../../../../../common/log_analysis'; import { CreateMLJobsButton } from './create_ml_jobs_button'; import { RecreateMLJobsButton } from './recreate_ml_jobs_button'; @@ -31,6 +32,19 @@ interface ProcessStepProps { viewResults: () => void; } +export const createProcessStep = (props: ProcessStepProps): EuiContainedStepProps => ({ + title: processStepTitle, + children: , + status: + props.setupStatus === 'pending' + ? 'incomplete' + : props.setupStatus === 'failed' + ? 'danger' + : props.setupStatus === 'succeeded' + ? 'complete' + : undefined, +}); + export const ProcessStep: React.FunctionComponent = ({ cleanupAndSetup, errorMessages, @@ -102,3 +116,7 @@ const errorCalloutTitle = i18n.translate( defaultMessage: 'An error occurred', } ); + +const processStepTitle = i18n.translate('xpack.infra.analysisSetup.actionStepTitle', { + defaultMessage: 'Create ML job', +}); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/recreate_ml_jobs_button.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/recreate_ml_jobs_button.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/process_step/recreate_ml_jobs_button.tsx rename to x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/recreate_ml_jobs_button.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_page.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_page.tsx new file mode 100644 index 0000000000000..a1c35aff0cf83 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_page.tsx @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + CommonProps, + EuiPage, + EuiPageBody, + EuiPageContent, + EuiPageContentBody, + EuiPageContentHeader, + EuiPageContentHeaderSection, + EuiTitle, +} from '@elastic/eui'; +import React from 'react'; + +import euiStyled from '../../../../../../common/eui_styled_components'; + +export const LogAnalysisSetupPage: React.FunctionComponent = ({ + children, + ...rest +}) => { + return ( + + + + {children} + + + + ); +}; + +export const LogAnalysisSetupPageHeader: React.FunctionComponent = ({ children }) => ( + + + +

{children}

+ + + +); + +export const LogAnalysisSetupPageContent = EuiPageContentBody; + +// !important due to https://github.com/elastic/eui/issues/2232 +const LogEntryRateSetupPageContent = euiStyled(EuiPageContent)` + max-width: 768px !important; +`; + +const LogEntryRateSetupPage = euiStyled(EuiPage)` + height: 100%; +`; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts index eb044c86e50fe..185f6936662bd 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts @@ -9,3 +9,4 @@ export * from './log_analysis_cleanup'; export * from './log_analysis_module'; export * from './log_analysis_module_status'; export * from './log_analysis_module_types'; +export * from './log_analysis_setup_state'; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx index 74dbb3c7a8062..f325f039367cd 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx @@ -6,8 +6,11 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; -import { ValidationIndicesError } from '../../../../common/http_api'; import { isExampleDataIndex } from '../../../../common/log_analysis'; +import { + ValidatedIndex, + ValidationIndicesUIError, +} from '../../../components/logging/log_analysis_setup/initial_configuration_step'; import { useTrackedPromise } from '../../../utils/use_tracked_promise'; import { ModuleDescriptor, ModuleSourceConfiguration } from './log_analysis_module_types'; @@ -17,25 +20,6 @@ type SetupHandler = ( endTime: number | undefined ) => void; -export type ValidationIndicesUIError = - | ValidationIndicesError - | { error: 'NETWORK_ERROR' } - | { error: 'TOO_FEW_SELECTED_INDICES' }; - -interface ValidIndex { - validity: 'valid'; - name: string; - isSelected: boolean; -} - -interface InvalidIndex { - validity: 'invalid'; - name: string; - errors: ValidationIndicesError[]; -} - -export type ValidatedIndex = ValidIndex | InvalidIndex; - interface AnalysisSetupStateArguments { cleanupAndSetupModule: SetupHandler; moduleDescriptor: ModuleDescriptor; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx index c41573f6ae8ea..a80464ed42cb2 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx @@ -14,26 +14,14 @@ import { MlUnavailablePrompt, } from '../../../components/logging/log_analysis_setup'; import { LogAnalysisCapabilities } from '../../../containers/logs/log_analysis'; -import { Source } from '../../../containers/source'; import { LogEntryRateResultsContent } from './page_results_content'; import { LogEntryRateSetupContent } from './page_setup_content'; import { useLogEntryRateModuleContext } from './use_log_entry_rate_module'; export const LogEntryRatePageContent = () => { - const { sourceId } = useContext(Source.Context); const { hasLogAnalysisCapabilites } = useContext(LogAnalysisCapabilities.Context); - const { - cleanUpAndSetUpModule: cleanupAndSetup, - fetchJobStatus, - fetchModuleDefinition, - lastSetupErrorMessages, - moduleDescriptor, - setUpModule, - setupStatus, - sourceConfiguration, - viewResults, - } = useLogEntryRateModuleContext(); + const { fetchJobStatus, fetchModuleDefinition, setupStatus } = useLogEntryRateModuleContext(); useEffect(() => { fetchModuleDefinition(); @@ -53,23 +41,8 @@ export const LogEntryRatePageContent = () => { } else if (setupStatus === 'unknown') { return ; } else if (isSetupStatusWithResults(setupStatus)) { - return ( - - ); + return ; } else { - return ( - - ); + return ; } }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx index be637bc29a0db..b6ab8acdea5b2 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx @@ -38,18 +38,22 @@ import { const JOB_STATUS_POLLING_INTERVAL = 30000; -export const LogEntryRateResultsContent = ({ - sourceId, - isFirstUse, -}: { - sourceId: string; - isFirstUse: boolean; -}) => { +export const LogEntryRateResultsContent: React.FunctionComponent = () => { useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_results' }); useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_results', delay: 15000 }); const [dateFormat] = useKibanaUiSetting('dateFormat', 'MMMM D, YYYY h:mm A'); + const { + fetchJobStatus, + jobStatus, + setupStatus, + viewSetupForReconfiguration, + viewSetupForUpdate, + jobIds, + sourceConfiguration: { sourceId }, + } = useLogEntryRateModuleContext(); + const { timeRange: selectedTimeRange, setTimeRange: setSelectedTimeRange, @@ -126,14 +130,7 @@ export const LogEntryRateResultsContent = ({ [setAutoRefresh] ); - const { - fetchJobStatus, - jobStatus, - setupStatus, - viewSetupForReconfiguration, - viewSetupForUpdate, - jobIds, - } = useLogEntryRateModuleContext(); + const isFirstUse = useMemo(() => setupStatus === 'hiddenAfterSuccess', [setupStatus]); useEffect(() => { getLogEntryRate(); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx index 6c04404b91231..0714f7e0ed06c 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx @@ -4,103 +4,59 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - EuiPage, - EuiPageBody, - EuiPageContent, - EuiPageContentBody, - EuiPageContentHeader, - EuiPageContentHeaderSection, - EuiSpacer, - EuiText, - EuiTitle, -} from '@elastic/eui'; +import { EuiSpacer, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; -import { SetupStatus } from '../../../../common/log_analysis'; -import { ModuleDescriptor, ModuleSourceConfiguration } from '../../../containers/logs/log_analysis'; import { useTrackPageview } from '../../../hooks/use_track_metric'; import { LogEntryRateSetupSteps } from './setup'; +import { + LogAnalysisSetupPage, + LogAnalysisSetupPageHeader, + LogAnalysisSetupPageContent, +} from '../../../components/logging/log_analysis_setup'; +import { useLogEntryRateModuleContext } from './use_log_entry_rate_module'; -type SetupHandler = ( - indices: string[], - startTime: number | undefined, - endTime: number | undefined -) => void; - -interface LogEntryRateSetupContentProps { - cleanupAndSetup: SetupHandler; - errorMessages: string[]; - moduleDescriptor: ModuleDescriptor; - setup: SetupHandler; - setupStatus: SetupStatus; - sourceConfiguration: ModuleSourceConfiguration; - viewResults: () => void; -} - -export const LogEntryRateSetupContent = ({ - cleanupAndSetup, - errorMessages, - setup, - setupStatus, - viewResults, - moduleDescriptor, - sourceConfiguration, -}: LogEntryRateSetupContentProps) => { +export const LogEntryRateSetupContent: React.FunctionComponent = () => { useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_setup' }); useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_setup', delay: 15000 }); + const { + cleanUpAndSetUpModule, + lastSetupErrorMessages, + moduleDescriptor, + sourceConfiguration, + setUpModule, + setupStatus, + viewResults, + } = useLogEntryRateModuleContext(); + return ( - - - - - - -

- -

-
-
-
- - - - - - - -
-
-
+ + + + + + + + + + + + ); }; - -// !important due to https://github.com/elastic/eui/issues/2232 -const LogEntryRateSetupPageContent = euiStyled(EuiPageContent)` - max-width: 768px !important; -`; - -const LogEntryRateSetupPage = euiStyled(EuiPage)` - height: 100%; -`; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx index 38aa4b068c9e9..e5e719c2d69f6 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx @@ -12,6 +12,7 @@ import { EuiStat, EuiTitle, EuiLoadingSpinner, + EuiButton, } from '@elastic/eui'; import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; @@ -97,6 +98,11 @@ export const AnomaliesResults: React.FunctionComponent<{

{title}

+ + + Recreate jobs + + diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx index 967c69dfae950..e02b914301aac 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx @@ -4,17 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiSteps, EuiStepStatus } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; +import { EuiSteps } from '@elastic/eui'; import React from 'react'; import { SetupStatus } from '../../../../../common/log_analysis'; -import { useAnalysisSetupState } from '../../../../containers/logs/log_analysis/log_analysis_setup_state'; -import { InitialConfigurationStep } from './initial_configuration_step'; -import { ProcessStep } from './process_step'; +import { + createInitialConfigurationStep, + createProcessStep, +} from '../../../../components/logging/log_analysis_setup'; import { ModuleDescriptor, ModuleSourceConfiguration, + useAnalysisSetupState, } from '../../../../containers/logs/log_analysis'; type SetupHandler = ( @@ -61,46 +62,24 @@ export const LogEntryRateSetupSteps = ({ }); const steps = [ - { - title: i18n.translate('xpack.infra.analysisSetup.configurationStepTitle', { - defaultMessage: 'Configuration', - }), - children: ( - - ), - }, - { - title: i18n.translate('xpack.infra.analysisSetup.actionStepTitle', { - defaultMessage: 'Create ML job', - }), - children: ( - - ), - status: - setupStatus === 'pending' - ? ('incomplete' as EuiStepStatus) - : setupStatus === 'failed' - ? ('danger' as EuiStepStatus) - : setupStatus === 'succeeded' - ? ('complete' as EuiStepStatus) - : undefined, - }, + createInitialConfigurationStep({ + setStartTime, + setEndTime, + startTime, + endTime, + isValidating, + validatedIndices, + setValidatedIndices, + validationErrors, + }), + createProcessStep({ + cleanupAndSetup, + errorMessages, + isConfigurationValid: validationErrors.length <= 0, + setup, + setupStatus, + viewResults, + }), ]; return ; From e4bfb04762fbab6f21d512b88eeebcbefa36f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Wed, 11 Dec 2019 18:59:15 +0100 Subject: [PATCH 06/16] Inline log entry rate job setup steps --- .../process_step/process_step.tsx | 14 +-- .../log_analysis/log_analysis_setup_state.tsx | 24 +++--- .../plugins/infra/public/pages/logs/index.tsx | 5 +- .../pages/logs/log_entry_categories/page.tsx | 2 +- .../log_entry_rate/page_setup_content.tsx | 77 ++++++++++++----- .../pages/logs/log_entry_rate/setup/index.ts | 7 -- .../logs/log_entry_rate/setup/setup_steps.tsx | 86 ------------------- .../use_log_entry_rate_setup.tsx | 54 ++++++++++++ 8 files changed, 134 insertions(+), 135 deletions(-) delete mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/index.ts delete mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx index f3ccba9e247ff..a15c7335b4acb 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/process_step/process_step.tsx @@ -24,10 +24,10 @@ import { CreateMLJobsButton } from './create_ml_jobs_button'; import { RecreateMLJobsButton } from './recreate_ml_jobs_button'; interface ProcessStepProps { - cleanupAndSetup: () => void; + cleanUpAndSetUp: () => void; errorMessages: string[]; isConfigurationValid: boolean; - setup: () => void; + setUp: () => void; setupStatus: SetupStatus; viewResults: () => void; } @@ -46,10 +46,10 @@ export const createProcessStep = (props: ProcessStepProps): EuiContainedStepProp }); export const ProcessStep: React.FunctionComponent = ({ - cleanupAndSetup, + cleanUpAndSetUp, errorMessages, isConfigurationValid, - setup, + setUp, setupStatus, viewResults, }) => { @@ -80,7 +80,7 @@ export const ProcessStep: React.FunctionComponent = ({ ))} - + = ({ ) : setupStatus === 'requiredForUpdate' || setupStatus === 'requiredForReconfiguration' ? ( - + ) : ( - + )} ); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx index f325f039367cd..9f966ed3342e6 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx @@ -21,18 +21,18 @@ type SetupHandler = ( ) => void; interface AnalysisSetupStateArguments { - cleanupAndSetupModule: SetupHandler; + cleanUpAndSetUpModule: SetupHandler; moduleDescriptor: ModuleDescriptor; - setupModule: SetupHandler; + setUpModule: SetupHandler; sourceConfiguration: ModuleSourceConfiguration; } const fourWeeksInMs = 86400000 * 7 * 4; export const useAnalysisSetupState = ({ - cleanupAndSetupModule, + cleanUpAndSetUpModule, moduleDescriptor: { validateSetupIndices }, - setupModule, + setUpModule, sourceConfiguration, }: AnalysisSetupStateArguments) => { const [startTime, setStartTime] = useState(Date.now() - fourWeeksInMs); @@ -91,13 +91,13 @@ export const useAnalysisSetupState = ({ [validatedIndices] ); - const setup = useCallback(() => { - return setupModule(selectedIndexNames, startTime, endTime); - }, [setupModule, selectedIndexNames, startTime, endTime]); + const setUp = useCallback(() => { + return setUpModule(selectedIndexNames, startTime, endTime); + }, [setUpModule, selectedIndexNames, startTime, endTime]); - const cleanupAndSetup = useCallback(() => { - return cleanupAndSetupModule(selectedIndexNames, startTime, endTime); - }, [cleanupAndSetupModule, selectedIndexNames, startTime, endTime]); + const cleanUpAndSetUp = useCallback(() => { + return cleanUpAndSetUpModule(selectedIndexNames, startTime, endTime); + }, [cleanUpAndSetUpModule, selectedIndexNames, startTime, endTime]); const isValidating = useMemo( () => @@ -127,13 +127,13 @@ export const useAnalysisSetupState = ({ }, [isValidating, validateIndicesRequest.state, selectedIndexNames, validatedIndices]); return { - cleanupAndSetup, + cleanUpAndSetUp, endTime, isValidating, selectedIndexNames, setEndTime, setStartTime, - setup, + setUp, startTime, validatedIndices, setValidatedIndices, diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx index 166dfca555adf..b0619fdcc2acf 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx @@ -21,13 +21,14 @@ import { Source, useSource } from '../../containers/source'; import { StreamPage } from './stream'; import { SettingsPage } from '../shared/settings'; import { AppNavigation } from '../../components/navigation/app_navigation'; -import { LogEntryRatePage } from './log_entry_rate'; import { useLogAnalysisCapabilities, LogAnalysisCapabilities, } from '../../containers/logs/log_analysis'; import { useSourceId } from '../../containers/source_id'; import { RedirectWithQueryParams } from '../../utils/redirect_with_query_params'; +import { LogEntryCategoriesPage } from './log_entry_categories'; +import { LogEntryRatePage } from './log_entry_rate'; interface LogsPageProps extends RouteComponentProps { uiCapabilities: UICapabilities; @@ -109,7 +110,7 @@ export const LogsPage = injectUICapabilities(({ match, uiCapabilities }: LogsPag - + { +export const LogEntryCategoriesPage = () => { return ( diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx index 0714f7e0ed06c..7e90cf29072e1 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx @@ -4,32 +4,77 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiSpacer, EuiText } from '@elastic/eui'; +import { EuiSpacer, EuiSteps, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import React from 'react'; +import React, { useMemo } from 'react'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; -import { LogEntryRateSetupSteps } from './setup'; import { + createInitialConfigurationStep, + createProcessStep, LogAnalysisSetupPage, - LogAnalysisSetupPageHeader, LogAnalysisSetupPageContent, + LogAnalysisSetupPageHeader, } from '../../../components/logging/log_analysis_setup'; -import { useLogEntryRateModuleContext } from './use_log_entry_rate_module'; +import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useLogEntryRateSetup } from './use_log_entry_rate_setup'; export const LogEntryRateSetupContent: React.FunctionComponent = () => { useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_setup' }); useTrackPageview({ app: 'infra_logs', path: 'log_entry_rate_setup', delay: 15000 }); const { - cleanUpAndSetUpModule, + cleanUpAndSetUp, + endTime, + isValidating, lastSetupErrorMessages, - moduleDescriptor, - sourceConfiguration, - setUpModule, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, setupStatus, + startTime, + validatedIndices, + validationErrors, viewResults, - } = useLogEntryRateModuleContext(); + } = useLogEntryRateSetup(); + + const steps = useMemo( + () => [ + createInitialConfigurationStep({ + setStartTime, + setEndTime, + startTime, + endTime, + isValidating, + validatedIndices, + setValidatedIndices, + validationErrors, + }), + createProcessStep({ + cleanUpAndSetUp, + errorMessages: lastSetupErrorMessages, + isConfigurationValid: validationErrors.length <= 0, + setUp, + setupStatus, + viewResults, + }), + ], + [ + cleanUpAndSetUp, + endTime, + isValidating, + lastSetupErrorMessages, + setEndTime, + setStartTime, + setUp, + setValidatedIndices, + setupStatus, + startTime, + validatedIndices, + validationErrors, + viewResults, + ] + ); return ( @@ -47,15 +92,7 @@ export const LogEntryRateSetupContent: React.FunctionComponent = () => { /> - + ); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/index.ts b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/index.ts deleted file mode 100644 index eba07aaa17fd2..0000000000000 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export * from './setup_steps'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx deleted file mode 100644 index e02b914301aac..0000000000000 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/setup/setup_steps.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { EuiSteps } from '@elastic/eui'; -import React from 'react'; - -import { SetupStatus } from '../../../../../common/log_analysis'; -import { - createInitialConfigurationStep, - createProcessStep, -} from '../../../../components/logging/log_analysis_setup'; -import { - ModuleDescriptor, - ModuleSourceConfiguration, - useAnalysisSetupState, -} from '../../../../containers/logs/log_analysis'; - -type SetupHandler = ( - indices: string[], - startTime: number | undefined, - endTime: number | undefined -) => void; - -interface LogEntryRateSetupStepsProps { - cleanupAndSetup: SetupHandler; - errorMessages: string[]; - setup: SetupHandler; - setupStatus: SetupStatus; - viewResults: () => void; - moduleDescriptor: ModuleDescriptor; - sourceConfiguration: ModuleSourceConfiguration; -} - -export const LogEntryRateSetupSteps = ({ - cleanupAndSetup: cleanupAndSetupModule, - errorMessages, - setup: setupModule, - setupStatus, - viewResults, - moduleDescriptor, - sourceConfiguration, -}: LogEntryRateSetupStepsProps) => { - const { - setup, - cleanupAndSetup, - setStartTime, - setEndTime, - startTime, - endTime, - isValidating, - validationErrors, - validatedIndices, - setValidatedIndices, - } = useAnalysisSetupState({ - cleanupAndSetupModule, - moduleDescriptor, - setupModule, - sourceConfiguration, - }); - - const steps = [ - createInitialConfigurationStep({ - setStartTime, - setEndTime, - startTime, - endTime, - isValidating, - validatedIndices, - setValidatedIndices, - validationErrors, - }), - createProcessStep({ - cleanupAndSetup, - errorMessages, - isConfigurationValid: validationErrors.length <= 0, - setup, - setupStatus, - viewResults, - }), - ]; - - return ; -}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx new file mode 100644 index 0000000000000..3595b6bf830fc --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useAnalysisSetupState } from '../../../containers/logs/log_analysis'; +import { useLogEntryRateModuleContext } from './use_log_entry_rate_module'; + +export const useLogEntryRateSetup = () => { + const { + cleanUpAndSetUpModule, + lastSetupErrorMessages, + moduleDescriptor, + setUpModule, + setupStatus, + sourceConfiguration, + viewResults, + } = useLogEntryRateModuleContext(); + + const { + cleanUpAndSetUp, + endTime, + isValidating, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, + startTime, + validatedIndices, + validationErrors, + } = useAnalysisSetupState({ + cleanUpAndSetUpModule, + moduleDescriptor, + setUpModule, + sourceConfiguration, + }); + + return { + cleanUpAndSetUp, + endTime, + isValidating, + lastSetupErrorMessages, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, + setupStatus, + startTime, + validatedIndices, + validationErrors, + viewResults, + }; +}; From 116786791c2e2479e001aa3a3673d0a969e3520b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 13:25:04 +0100 Subject: [PATCH 07/16] Properly handle validation of missing indices --- .../infra/server/routes/log_analysis/validation/indices.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts b/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts index ba143a597b66d..fe579124cfe10 100644 --- a/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts +++ b/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts @@ -42,8 +42,10 @@ export const initValidateLogAnalysisIndicesRoute = ({ framework }: InfraBackendL await Promise.all( indices.map(async index => { const fieldCaps = await framework.callWithRequest(requestContext, 'fieldCaps', { - index, + allow_no_indices: true, fields: fields.map(field => field.name), + ignore_unavailable: true, + index, }); if (fieldCaps.indices.length === 0) { From ce5fe9d08ae4ad60809d3ebecacafcaade856c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 15:32:21 +0100 Subject: [PATCH 08/16] Wire up the categorization setup screen --- .../pages/logs/log_entry_categories/page.tsx | 4 +- .../log_entry_categories/page_content.tsx | 37 ++----- .../page_setup_content.tsx | 99 +++++++++++++++++++ .../use_log_entry_categories_setup.tsx | 54 ++++++++++ 4 files changed, 161 insertions(+), 33 deletions(-) create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx create mode 100644 x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx index c042ea2eab66d..64e83a6eaa497 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx @@ -7,14 +7,14 @@ import React from 'react'; import { ColumnarPage } from '../../../components/page'; -// import { LogEntryCategoriesPageContent } from './page_content'; +import { LogEntryCategoriesPageContent } from './page_content'; import { LogEntryCategoriesPageProviders } from './page_providers'; export const LogEntryCategoriesPage = () => { return ( - {/* */} + ); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx index 176af0f3170fa..9a50acf622ee1 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx @@ -14,39 +14,30 @@ import { MlUnavailablePrompt, } from '../../../components/logging/log_analysis_setup'; import { LogAnalysisCapabilities } from '../../../containers/logs/log_analysis'; -// import { Source } from '../../../containers/source'; -// import { LogEntryCategoriesResultsContent } from './page_results_content'; -// import { LogEntryCategoriesSetupContent } from './page_setup_content'; +import { LogEntryCategoriesSetupContent } from './page_setup_content'; import { useLogEntryCategoriesModuleContext } from './use_log_entry_categories_module'; export const LogEntryCategoriesPageContent = () => { - // const { sourceId } = useContext(Source.Context); const { hasLogAnalysisCapabilites } = useContext(LogAnalysisCapabilities.Context); const { - // cleanUpAndSetUpModule: cleanupAndSetup, fetchJobStatus, fetchModuleDefinition, - // lastSetupErrorMessages, - // moduleDescriptor, - // setUpModule, setupStatus, - // sourceConfiguration, - // viewResults, } = useLogEntryCategoriesModuleContext(); useEffect(() => { fetchModuleDefinition(); fetchJobStatus(); - }, []); + }, [fetchJobStatus, fetchModuleDefinition]); if (!hasLogAnalysisCapabilites) { return ; } else if (setupStatus === 'initializing') { return ( ); @@ -54,24 +45,8 @@ export const LogEntryCategoriesPageContent = () => { return ; } else if (isSetupStatusWithResults(setupStatus)) { return null; - // return ( - // - // ); + // return ; } else { - return null; - // return ( - // - // ); + return ; } }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx new file mode 100644 index 0000000000000..f0e90cb7ccc05 --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiSpacer, EuiSteps, EuiText } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React, { useMemo } from 'react'; + +import { + createInitialConfigurationStep, + createProcessStep, + LogAnalysisSetupPage, + LogAnalysisSetupPageContent, + LogAnalysisSetupPageHeader, +} from '../../../components/logging/log_analysis_setup'; +import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useLogEntryCategoriesSetup } from './use_log_entry_categories_setup'; + +export const LogEntryCategoriesSetupContent: React.FunctionComponent = () => { + useTrackPageview({ app: 'infra_logs', path: 'log_entry_categories_setup' }); + useTrackPageview({ app: 'infra_logs', path: 'log_entry_categories_setup', delay: 15000 }); + + const { + cleanUpAndSetUp, + endTime, + isValidating, + lastSetupErrorMessages, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, + setupStatus, + startTime, + validatedIndices, + validationErrors, + viewResults, + } = useLogEntryCategoriesSetup(); + + const steps = useMemo( + () => [ + createInitialConfigurationStep({ + setStartTime, + setEndTime, + startTime, + endTime, + isValidating, + validatedIndices, + setValidatedIndices, + validationErrors, + }), + createProcessStep({ + cleanUpAndSetUp, + errorMessages: lastSetupErrorMessages, + isConfigurationValid: validationErrors.length <= 0, + setUp, + setupStatus, + viewResults, + }), + ], + [ + cleanUpAndSetUp, + endTime, + isValidating, + lastSetupErrorMessages, + setEndTime, + setStartTime, + setUp, + setValidatedIndices, + setupStatus, + startTime, + validatedIndices, + validationErrors, + viewResults, + ] + ); + + return ( + + + + + + + + + + + + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx new file mode 100644 index 0000000000000..c011230942d7c --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useAnalysisSetupState } from '../../../containers/logs/log_analysis'; +import { useLogEntryCategoriesModuleContext } from './use_log_entry_categories_module'; + +export const useLogEntryCategoriesSetup = () => { + const { + cleanUpAndSetUpModule, + lastSetupErrorMessages, + moduleDescriptor, + setUpModule, + setupStatus, + sourceConfiguration, + viewResults, + } = useLogEntryCategoriesModuleContext(); + + const { + cleanUpAndSetUp, + endTime, + isValidating, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, + startTime, + validatedIndices, + validationErrors, + } = useAnalysisSetupState({ + cleanUpAndSetUpModule, + moduleDescriptor, + setUpModule, + sourceConfiguration, + }); + + return { + cleanUpAndSetUp, + endTime, + isValidating, + lastSetupErrorMessages, + setEndTime, + setStartTime, + setValidatedIndices, + setUp, + setupStatus, + startTime, + validatedIndices, + validationErrors, + viewResults, + }; +}; From f28dc75695ea4b845f3d6085caca186d4a576dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 16:17:10 +0100 Subject: [PATCH 09/16] Decode the deleting ml job state --- .../containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts index 91e517b0db008..2e1ba52353bef 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts @@ -49,6 +49,7 @@ const datafeedStateRT = rt.keyof({ const jobStateRT = rt.keyof({ closed: null, closing: null, + deleting: null, failed: null, opened: null, opening: null, From 59e719251f1d462cbed60b04f053ba4c3140df4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 16:17:36 +0100 Subject: [PATCH 10/16] Increase the model memory limit --- .../logs_ui_categories/ml/log_entry_categories_count.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json index bd57c495ea8f3..b7bddfd779ea6 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json @@ -17,7 +17,7 @@ "influencers": ["event.dataset", "mlcategory"] }, "analysis_limits": { - "model_memory_limit": "10mb", + "model_memory_limit": "100mb", "categorization_examples_limit": 1 }, "data_description": { From eaf313d896ad083b57a104bfe45da8f33fd585c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 16:20:24 +0100 Subject: [PATCH 11/16] Fix incomplete hook dependency list --- .../log_entry_categories/use_log_entry_categories_module.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx index 363ff080142d8..918c252f6350c 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx @@ -31,7 +31,7 @@ export const useLogEntryCategoriesModule = ({ spaceId, timestampField, }), - [indexPattern] + [indexPattern, sourceId, spaceId, timestampField] ); return useLogAnalysisModule({ From 39ef4c4ac5e9d9328714fed1a13d606a6dd974b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 19:27:48 +0100 Subject: [PATCH 12/16] Fix translations --- x-pack/plugins/translations/translations/ja-JP.json | 6 ------ x-pack/plugins/translations/translations/zh-CN.json | 6 ------ 2 files changed, 12 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index f047e6a506f82..60d654217ffd0 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -6084,13 +6084,9 @@ "xpack.infra.logs.analysis.logRateSectionNoDataTitle": "表示するデータがありません。", "xpack.infra.logs.analysis.logRateSectionTitle": "ログレート", "xpack.infra.logs.analysisPage.loadingMessage": "分析ジョブのステータスを確認中…", - "xpack.infra.logs.analysisPage.unavailable.mlAppButton": "機械学習を開く", "xpack.infra.logs.analysisPage.unavailable.mlAppLink": "機械学習アプリ", - "xpack.infra.logs.analysisPage.unavailable.mlDisabledBody": "詳細は {machineLearningAppLink} をご覧ください。", - "xpack.infra.logs.analysisPage.unavailable.mLDisabledTitle": "分析機能には機械学習が必要です", "xpack.infra.logs.highlights.goToNextHighlightButtonLabel": "次のハイライトにスキップ", "xpack.infra.logs.highlights.goToPreviousHighlightButtonLabel": "前のハイライトにスキップ", - "xpack.infra.logs.index.analysisBetaBadgeTitle": "分析", "xpack.infra.logs.index.settingsTabTitle": "設定", "xpack.infra.logs.index.streamTabTitle": "ストリーム", "xpack.infra.logs.logsAnalysisResults.onboardingSuccessContent": "機械学習ロボットがデータの収集を開始するまでしばらくお待ちください。", @@ -6181,8 +6177,6 @@ "xpack.infra.logs.analysis.overallAnomalyChartMaxScoresLabel": "最高異常スコア", "xpack.infra.logs.analysis.partitionMaxAnomalyScoreAnnotationLabel": "最高異常スコア: {maxAnomalyScore}", "xpack.infra.logs.analysis.recreateJobButtonLabel": "ML ジョブを再作成", - "xpack.infra.logs.analysisPage.setupStatusUnknown.title": "ML ジョブのステータスを特定できませんでした。", - "xpack.infra.logs.analysisPage.setupStatusUnknown.tryAgainButton": "再試行", "xpack.infra.logs.jumpToTailText": "最も新しいエントリーに移動", "xpack.infra.metricsExplorer.chartOptions.barLabel": "バー", "xpack.infra.nodeDetails.labels.availabilityZone": "アベイラビリティゾーン", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 1be193f83d3bd..678751cd63010 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -6086,13 +6086,9 @@ "xpack.infra.logs.analysis.logRateSectionNoDataTitle": "没有可显示的数据。", "xpack.infra.logs.analysis.logRateSectionTitle": "日志速率", "xpack.infra.logs.analysisPage.loadingMessage": "正在检查分析作业的状态......", - "xpack.infra.logs.analysisPage.unavailable.mlAppButton": "打开 Machine Learning", "xpack.infra.logs.analysisPage.unavailable.mlAppLink": "Machine Learning 应用", - "xpack.infra.logs.analysisPage.unavailable.mlDisabledBody": "查看 {machineLearningAppLink}以了解更多信息。", - "xpack.infra.logs.analysisPage.unavailable.mLDisabledTitle": "分析功能需要 Machine Learning", "xpack.infra.logs.highlights.goToNextHighlightButtonLabel": "跳转到下一高亮条目", "xpack.infra.logs.highlights.goToPreviousHighlightButtonLabel": "跳转到上一高亮条目", - "xpack.infra.logs.index.analysisBetaBadgeTitle": "分析", "xpack.infra.logs.index.settingsTabTitle": "设置", "xpack.infra.logs.index.streamTabTitle": "流式传输", "xpack.infra.logs.logsAnalysisResults.onboardingSuccessContent": "请注意,我们的 Machine Learning 机器人若干分钟后才会开始收集数据。", @@ -6183,8 +6179,6 @@ "xpack.infra.logs.analysis.overallAnomalyChartMaxScoresLabel": "最大异常分数:", "xpack.infra.logs.analysis.partitionMaxAnomalyScoreAnnotationLabel": "最大异常分数:{maxAnomalyScore}", "xpack.infra.logs.analysis.recreateJobButtonLabel": "重新创建 ML 作业", - "xpack.infra.logs.analysisPage.setupStatusUnknown.title": "我们无法确定您的 ML 作业的状态。", - "xpack.infra.logs.analysisPage.setupStatusUnknown.tryAgainButton": "请重试", "xpack.infra.logs.jumpToTailText": "跳到最近的条目", "xpack.infra.metricsExplorer.chartOptions.barLabel": "条形图", "xpack.infra.nodeDetails.labels.availabilityZone": "可用区", From 73b4c869bd7d6aeb69c8221b17ea7a1658851c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 12 Dec 2019 20:28:57 +0100 Subject: [PATCH 13/16] Include new module in data recognizer unit test --- .../server/models/data_recognizer/__tests__/data_recognizer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/__tests__/data_recognizer.js b/x-pack/legacy/plugins/ml/server/models/data_recognizer/__tests__/data_recognizer.js index af5039fafdc60..ce9d8b3ff7362 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/__tests__/data_recognizer.js +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/__tests__/data_recognizer.js @@ -16,6 +16,7 @@ describe('ML - data recognizer', () => { 'auditbeat_process_docker_ecs', 'auditbeat_process_hosts_ecs', 'logs_ui_analysis', + 'logs_ui_categories', 'metricbeat_system_ecs', 'nginx_ecs', 'sample_data_ecommerce', From c3178534225457ee8d8905bfa6b34b3cbb428baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Mon, 16 Dec 2019 12:19:56 +0100 Subject: [PATCH 14/16] Restore lost h3 elements --- .../analysis_setup_indices_form.tsx | 10 ++++++---- .../analysis_setup_timerange_form.tsx | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx index 6d7b694423e0a..3334e565f70f7 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx @@ -59,10 +59,12 @@ export const AnalysisSetupIndicesForm: React.FunctionComponent<{ +

+ +

} description={ +

+ +

} description={ Date: Tue, 17 Dec 2019 19:53:45 +0100 Subject: [PATCH 15/16] Improve module and job descriptions as per feedback --- .../data_recognizer/modules/logs_ui_categories/manifest.json | 2 +- .../logs_ui_categories/ml/log_entry_categories_count.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json index 92d7671e3cfbf..b31ddacde8b6d 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/manifest.json @@ -1,7 +1,7 @@ { "id": "logs_ui_categories", "title": "Log entry categories", - "description": "Categorize log entries in the Logs UI", + "description": "Detect anomalies in count of log entries by category", "type": "Logs", "logoFile": "logo.json", "jobs": [ diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json index b7bddfd779ea6..b4fb242f16522 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_categories/ml/log_entry_categories_count.json @@ -1,6 +1,6 @@ { "job_type": "anomaly_detector", - "description": "Categorize log entries and detect count anomalies", + "description": "Logs UI: Detects anomalies in count of log entries by category", "groups": ["logs-ui"], "analysis_config": { "bucket_span": "15m", @@ -8,7 +8,7 @@ "detectors": [ { "by_field_name": "mlcategory", - "detector_description": "count by mlcategory", + "detector_description": "count by learned log entry category", "function": "count", "partition_field_name": "event.dataset", "use_null": true From a6927e1ede9bd6066400b94f367cf760ac89e76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Tue, 17 Dec 2019 20:07:07 +0100 Subject: [PATCH 16/16] Improve log rate ml job description --- .../modules/logs_ui_analysis/ml/log_entry_rate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_analysis/ml/log_entry_rate.json b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_analysis/ml/log_entry_rate.json index 5279b18fb03b3..42ba15591e5c4 100644 --- a/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_analysis/ml/log_entry_rate.json +++ b/x-pack/legacy/plugins/ml/server/models/data_recognizer/modules/logs_ui_analysis/ml/log_entry_rate.json @@ -1,6 +1,6 @@ { "job_type": "anomaly_detector", - "description": "Detect anomalies in the log entry ingestion rate", + "description": "Logs UI: Detects anomalies in the log entry ingestion rate", "groups": ["logs-ui"], "analysis_config": { "bucket_span": "15m",