[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:
Chris Roberson 2019-06-13 09:28:54 -04:00 committed by GitHub
parent 6c0f83a515
commit 25802019ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 6 deletions

View file

@ -164,3 +164,8 @@ export const INDEX_PATTERN_FILEBEAT = 'filebeat-*';
// This is the unique token that exists in monitoring indices collected by metricbeat
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';

View file

@ -5,7 +5,7 @@
*/
import { resolve } from 'path';
import { init } from './init';
import { init, postInit } from './init';
import { config } from './config';
import { deprecations } from './deprecations';
import { getUiExports } from './ui_exports';
@ -24,4 +24,7 @@ export const monitoring = (kibana) => new kibana.Plugin({
config,
deprecations,
uiExports: getUiExports(),
postInit(server) {
postInit(server);
},
});

View file

@ -15,6 +15,7 @@ import {
getOpsStatsCollector,
getSettingsCollector,
} 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
@ -116,3 +117,7 @@ export const init = (monitoringPlugin, server) => {
};
});
};
export const postInit = server => {
initInfraSource(server);
};

View file

@ -15,7 +15,7 @@ exports[`Logs should render a link to filter by cluster uuid 1`] = `
Object {
"link": <EuiLink
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"
>
Logs
@ -42,7 +42,7 @@ exports[`Logs should render a link to filter by cluster uuid and index uuid 1`]
Object {
"link": <EuiLink
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"
>
Logs
@ -69,7 +69,7 @@ exports[`Logs should render a link to filter by cluster uuid and node uuid 1`] =
Object {
"link": <EuiLink
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"
>
Logs
@ -297,7 +297,7 @@ exports[`Logs should render normally 1`] = `
Object {
"link": <EuiLink
color="primary"
href="/app/infra#/link-to/logs"
href="/app/infra#/link-to/internal-stack-monitoring/logs"
type="button"
>
Logs

View file

@ -14,6 +14,7 @@ import {
EuiCallOut,
EuiLink,
} from '@elastic/eui';
import { INFRA_SOURCE_ID } from '../../../common/constants';
import { formatDateTimeLocal } from '../../../common/formatting';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
@ -110,7 +111,7 @@ const clusterColumns = [
];
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 = [];
if (clusterUuid) {

View file

@ -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
});
}
};