[Monitoring] Integrate logs source for Logs UI (#36929)
* Define and use an internal log ui source configuration * Fix urls in tests * Remove unnecessary code
This commit is contained in:
parent
6c0f83a515
commit
25802019ae
|
@ -164,3 +164,8 @@ export const INDEX_PATTERN_FILEBEAT = 'filebeat-*';
|
||||||
|
|
||||||
// This is the unique token that exists in monitoring indices collected by metricbeat
|
// This is the unique token that exists in monitoring indices collected by metricbeat
|
||||||
export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-';
|
export const METRICBEAT_INDEX_NAME_UNIQUE_TOKEN = '-mb-';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the infra source owned by the monitoring plugin.
|
||||||
|
*/
|
||||||
|
export const INFRA_SOURCE_ID = 'internal-stack-monitoring';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { init } from './init';
|
import { init, postInit } from './init';
|
||||||
import { config } from './config';
|
import { config } from './config';
|
||||||
import { deprecations } from './deprecations';
|
import { deprecations } from './deprecations';
|
||||||
import { getUiExports } from './ui_exports';
|
import { getUiExports } from './ui_exports';
|
||||||
|
@ -24,4 +24,7 @@ export const monitoring = (kibana) => new kibana.Plugin({
|
||||||
config,
|
config,
|
||||||
deprecations,
|
deprecations,
|
||||||
uiExports: getUiExports(),
|
uiExports: getUiExports(),
|
||||||
|
postInit(server) {
|
||||||
|
postInit(server);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
getOpsStatsCollector,
|
getOpsStatsCollector,
|
||||||
getSettingsCollector,
|
getSettingsCollector,
|
||||||
} from './server/kibana_monitoring/collectors';
|
} from './server/kibana_monitoring/collectors';
|
||||||
|
import { initInfraSource } from './server/lib/logs/init_infra_source';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the Kibana Monitoring plugin by starting up asynchronous server tasks
|
* Initialize the Kibana Monitoring plugin by starting up asynchronous server tasks
|
||||||
|
@ -116,3 +117,7 @@ export const init = (monitoringPlugin, server) => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const postInit = server => {
|
||||||
|
initInfraSource(server);
|
||||||
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ exports[`Logs should render a link to filter by cluster uuid 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"link": <EuiLink
|
"link": <EuiLink
|
||||||
color="primary"
|
color="primary"
|
||||||
href="/app/infra#/link-to/logs?filter=elasticsearch.cluster.uuid:12345"
|
href="/app/infra#/link-to/internal-stack-monitoring/logs?filter=elasticsearch.cluster.uuid:12345"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
Logs
|
Logs
|
||||||
|
@ -42,7 +42,7 @@ exports[`Logs should render a link to filter by cluster uuid and index uuid 1`]
|
||||||
Object {
|
Object {
|
||||||
"link": <EuiLink
|
"link": <EuiLink
|
||||||
color="primary"
|
color="primary"
|
||||||
href="/app/infra#/link-to/logs?filter=elasticsearch.cluster.uuid:12345 and elasticsearch.index.name:6789"
|
href="/app/infra#/link-to/internal-stack-monitoring/logs?filter=elasticsearch.cluster.uuid:12345 and elasticsearch.index.name:6789"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
Logs
|
Logs
|
||||||
|
@ -69,7 +69,7 @@ exports[`Logs should render a link to filter by cluster uuid and node uuid 1`] =
|
||||||
Object {
|
Object {
|
||||||
"link": <EuiLink
|
"link": <EuiLink
|
||||||
color="primary"
|
color="primary"
|
||||||
href="/app/infra#/link-to/logs?filter=elasticsearch.cluster.uuid:12345 and elasticsearch.node.id:6789"
|
href="/app/infra#/link-to/internal-stack-monitoring/logs?filter=elasticsearch.cluster.uuid:12345 and elasticsearch.node.id:6789"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
Logs
|
Logs
|
||||||
|
@ -297,7 +297,7 @@ exports[`Logs should render normally 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"link": <EuiLink
|
"link": <EuiLink
|
||||||
color="primary"
|
color="primary"
|
||||||
href="/app/infra#/link-to/logs"
|
href="/app/infra#/link-to/internal-stack-monitoring/logs"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
Logs
|
Logs
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
EuiCallOut,
|
EuiCallOut,
|
||||||
EuiLink,
|
EuiLink,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
|
import { INFRA_SOURCE_ID } from '../../../common/constants';
|
||||||
import { formatDateTimeLocal } from '../../../common/formatting';
|
import { formatDateTimeLocal } from '../../../common/formatting';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
@ -110,7 +111,7 @@ const clusterColumns = [
|
||||||
];
|
];
|
||||||
|
|
||||||
function getLogsUiLink(clusterUuid, nodeId, indexUuid) {
|
function getLogsUiLink(clusterUuid, nodeId, indexUuid) {
|
||||||
const base = `${chrome.getBasePath()}/app/infra#/link-to/logs`;
|
const base = `${chrome.getBasePath()}/app/infra#/link-to/${INFRA_SOURCE_ID}/logs`;
|
||||||
|
|
||||||
const params = [];
|
const params = [];
|
||||||
if (clusterUuid) {
|
if (clusterUuid) {
|
||||||
|
|
|
@ -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 { prefixIndexPattern } from '../ccs_utils';
|
||||||
|
import { INDEX_PATTERN_FILEBEAT, INFRA_SOURCE_ID } from '../../../common/constants';
|
||||||
|
|
||||||
|
export const initInfraSource = server => {
|
||||||
|
const infraPlugin = server.plugins.infra;
|
||||||
|
|
||||||
|
if (infraPlugin) {
|
||||||
|
const config = server.config();
|
||||||
|
const filebeatIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_FILEBEAT, '*');
|
||||||
|
infraPlugin.defineInternalSourceConfiguration(INFRA_SOURCE_ID, {
|
||||||
|
name: 'Elastic Stack Logs',
|
||||||
|
logAlias: filebeatIndexPattern
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue