Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into migrate-configs
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Feb 10, 2020
2 parents 8740c97 + 181a3a0 commit a7a135f
Show file tree
Hide file tree
Showing 149 changed files with 2,059 additions and 1,070 deletions.
39 changes: 39 additions & 0 deletions docs/apm/troubleshooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ your proposed changes at https://github.com/elastic/kibana.

Also check out the https://discuss.elastic.co/c/apm[APM discussion forum].

[[no-apm-data-found]]
==== No APM data found

This section can help with any of the following:
Expand Down Expand Up @@ -69,3 +70,41 @@ or because something is happening to the request that the Agent doesn't understa
To resolve this, you'll need to head over to the relevant {apm-agents-ref}[Agent documentation].
Specifically, view the Agent's supported technologies page.
You can also use the Agent's public API to manually set a name for the transaction.

==== Fields are not searchable

In Elasticsearch, index patterns are used to define settings and mappings that determine how fields should be analyzed.
The recommended index template file for APM Server is installed when Kibana starts.
This template defines which fields are available in Kibana for features like the Kuery bar,
or for linking to other plugins like Logs, Uptime, and Discover.

As an example, some agents store cookie values in `http.request.cookies`.
Since `http.request` has disabled dynamic indexing, and `http.request.cookies` is not declared in a custom mapping,
the values in `http.request.cookies` are not indexed and thus not searchable.

*Ensure an index pattern exists*
As a first step, you should ensure the correct index pattern exists.
In Kibana, navigate to *Management > Kibana > Index Patterns*.
In the pattern list, you should see an apm index pattern; The default is `apm-*`.
If you don't, the index pattern doesn't exist. See <<no-apm-data-found>> for information on how to fix this problem.

Selecting the `apm-*` index pattern shows a listing of every field defined in the pattern.

*Ensure a field is searchable*
There are two things you can do to if you'd like to ensure a field is searchable:

1. Index your additional data as {apm-overview-ref}/metadata.html[labels] instead.
These are dynamic by default, which means they will be indexed and become searchable and aggregatable.

2. Use the {apm-server-ref}/configuration-template.html[`append_fields`] feature. As an example,
adding the following to `apm-server.yml` will enable dynamic indexing for `http.request.cookies`:

[source,yml]
----
setup.template.enabled: true
setup.template.overwrite: true
setup.template.append_fields:
- name: http.request.cookies
type: object
dynamic: true
----
47 changes: 47 additions & 0 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[role="xpack"]
[[alert-action-settings-kb]]
=== Alerting and action settings in Kibana
++++
<titleabbrev>Alerting and action settings</titleabbrev>
++++

Alerts and actions are enabled by default in {kib}, but require you configure the following in order to use them:

. <<using-kibana-with-security,Set up {kib} to work with {stack} {security-features}>>.
. <<configuring-tls-kib-es,Set up TLS encryption between {kib} and {es}>>.
. <<general-alert-action-settings,Specify a value for `xpack.encrypted_saved_objects.encryptionKey`>>.

You can configure the following settings in the `kibana.yml` file.


[float]
[[general-alert-action-settings]]
==== General settings

`xpack.encrypted_saved_objects.encryptionKey`::

A string of 32 or more characters used to encrypt sensitive properties on alerts and actions before they're stored in {es}. Third party credentials &mdash; such as the username and password used to connect to an SMTP service &mdash; are an example of encrypted properties.
+
If not set, {kib} will generate a random key on startup, but all alert and action functions will be blocked. Generated keys are not allowed for alerts and actions because when a new key is generated on restart, existing encrypted data becomes inaccessible. For the same reason, alerts and actions in high-availability deployments of {kib} will behave unexpectedly if the key isn't the same on all instances of {kib}.
+
Although the key can be specified in clear text in `kibana.yml`, it's recommended to store this key securely in the <<secure-settings,{kib} Keystore>>.

[float]
[[alert-settings]]
==== Action settings

`xpack.actions.whitelistedHosts`::
A list of hostnames that {kib} is allowed to connect to when built-in actions are triggered. It defaults to `[*]`, allowing any host, but keep in mind the potential for SSRF attacks when hosts are not explicitly whitelisted. An empty list `[]` can be used to block built-in actions from making any external connections.
+
Note that hosts associated with built-in actions, such as Slack and PagerDuty, are not automatically whitelisted. If you are not using the default `[*]` setting, you must ensure that the corresponding endpoints are whitelisted as well.

`xpack.actions.enabledActionTypes`::
A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, and `.webhook`. An empty list `[]` will disable all action types.
+
Disabled action types will not appear as an option when creating new connectors, but existing connectors and actions of that type will remain in {kib} and will not function.

[float]
[[action-settings]]
==== Alert settings

You do not need to configure any additional settings to use alerting in {kib}.
1 change: 1 addition & 0 deletions docs/settings/settings-xkb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include::{asciidoc-dir}/../../shared/settings.asciidoc[]

For more {kib} configuration settings, see <<settings>>.

include::alert-action-settings.asciidoc[]
include::apm-settings.asciidoc[]
include::dev-settings.asciidoc[]
include::graph-settings.asciidoc[]
Expand Down
11 changes: 1 addition & 10 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,7 @@ Rollup user interface.

`i18n.locale`:: *Default: en* Set this value to change the Kibana interface language. Valid locales are: `en`, `zh-CN`, `ja-JP`.

`xpack.actions.enabledActionTypes:`:: *Default: +[ {asterisk} ]+* Set this value
to an array of action types that are enabled. An element of `*` indicates all
action types registered are enabled. The action types provided by Kibana are:
`.server-log`, `.slack`, `.email`, `.index`, `.pagerduty`, `.webhook`.

`xpack.actions.whitelistedHosts:`:: *Default: +[ {asterisk} ]+* Set this value
to an array of host names which actions such as email, slack, pagerduty, and
webhook can connect to. An element of `*` indicates any host can be connected
to. An empty array indicates no hosts can be connected to.

include::{docdir}/settings/alert-action-settings.asciidoc[]
include::{docdir}/settings/apm-settings.asciidoc[]
include::{docdir}/settings/dev-settings.asciidoc[]
include::{docdir}/settings/graph-settings.asciidoc[]
Expand Down
24 changes: 2 additions & 22 deletions src/legacy/core_plugins/kibana/public/dashboard/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,14 @@
*/

import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart, legacyChrome } from './legacy_imports';
import { LegacyAngularInjectedDependencies } from './plugin';
import { npSetup, npStart } from './legacy_imports';
import { start as data } from '../../../data/public/legacy';
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
import './dashboard_config';
import { plugin } from './index';

/**
* Get dependencies relying on the global angular context.
* They also have to get resolved together with the legacy imports above
*/
async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> {
const injector = await legacyChrome.dangerouslyGetActiveInjector();

return {
dashboardConfig: injector.get('dashboardConfig'),
};
}

(async () => {
const instance = plugin({} as PluginInitializerContext);
instance.setup(npSetup.core, {
...npSetup.plugins,
npData: npSetup.plugins.data,
__LEGACY: {
getAngularDependencies,
},
});
instance.setup(npSetup.core, npSetup.plugins);
instance.start(npStart.core, {
...npStart.plugins,
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface RenderDeps {
navigation: NavigationStart;
savedObjectsClient: SavedObjectsClientContract;
savedDashboards: SavedObjectLoader;
dashboardConfig: any;
dashboardConfig: KibanaLegacyStart['dashboardConfig'];
dashboardCapabilities: any;
uiSettings: IUiSettingsClient;
chrome: ChromeStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ import {
removeQueryParam,
unhashUrl,
} from '../../../../../../plugins/kibana_utils/public';
import { KibanaLegacyStart } from '../../../../../../plugins/kibana_legacy/public';

export interface DashboardAppControllerDependencies extends RenderDeps {
$scope: DashboardAppScope;
$route: any;
$routeParams: any;
indexPatterns: IndexPatternsContract;
dashboardConfig: any;
dashboardConfig: KibanaLegacyStart['dashboardConfig'];
confirmModal: ConfirmModalFn;
history: History;
kbnUrlStateStorage: IKbnUrlStateStorage;
Expand Down
33 changes: 16 additions & 17 deletions src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,25 @@ import { SharePluginStart } from '../../../../../plugins/share/public';
import {
AngularRenderedAppUpdater,
KibanaLegacySetup,
KibanaLegacyStart,
} from '../../../../../plugins/kibana_legacy/public';
import { createSavedDashboardLoader } from './saved_dashboard/saved_dashboards';
import { createKbnUrlTracker } from '../../../../../plugins/kibana_utils/public';
import { getQueryStateContainer } from '../../../../../plugins/data/public';

export interface LegacyAngularInjectedDependencies {
dashboardConfig: any;
}

export interface DashboardPluginStartDependencies {
data: DataStart;
npData: NpDataStart;
embeddables: IEmbeddableStart;
navigation: NavigationStart;
share: SharePluginStart;
kibanaLegacy: KibanaLegacyStart;
}

export interface DashboardPluginSetupDependencies {
__LEGACY: {
getAngularDependencies: () => Promise<LegacyAngularInjectedDependencies>;
};
home: HomePublicPluginSetup;
kibanaLegacy: KibanaLegacySetup;
npData: NpDataSetup;
data: NpDataSetup;
}

export class DashboardPlugin implements Plugin {
Expand All @@ -78,19 +73,15 @@ export class DashboardPlugin implements Plugin {
embeddables: IEmbeddableStart;
navigation: NavigationStart;
share: SharePluginStart;
dashboardConfig: KibanaLegacyStart['dashboardConfig'];
} | null = null;

private appStateUpdater = new BehaviorSubject<AngularRenderedAppUpdater>(() => ({}));
private stopUrlTracking: (() => void) | undefined = undefined;

public setup(
core: CoreSetup,
{
__LEGACY: { getAngularDependencies },
home,
kibanaLegacy,
npData,
}: DashboardPluginSetupDependencies
{ home, kibanaLegacy, data: npData }: DashboardPluginSetupDependencies
) {
const { querySyncStateContainer, stop: stopQuerySyncStateContainer } = getQueryStateContainer(
npData.query
Expand Down Expand Up @@ -126,8 +117,8 @@ export class DashboardPlugin implements Plugin {
navigation,
share,
npDataStart,
dashboardConfig,
} = this.startDependencies;
const angularDependencies = await getAngularDependencies();
const savedDashboards = createSavedDashboardLoader({
savedObjectsClient,
indexPatterns: npDataStart.indexPatterns,
Expand All @@ -137,7 +128,7 @@ export class DashboardPlugin implements Plugin {

const deps: RenderDeps = {
core: contextCore as LegacyCoreStart,
...angularDependencies,
dashboardConfig,
navigation,
share,
npDataStart,
Expand Down Expand Up @@ -186,14 +177,22 @@ export class DashboardPlugin implements Plugin {

start(
{ savedObjects: { client: savedObjectsClient } }: CoreStart,
{ data: dataStart, embeddables, navigation, npData, share }: DashboardPluginStartDependencies
{
data: dataStart,
embeddables,
navigation,
npData,
share,
kibanaLegacy: { dashboardConfig },
}: DashboardPluginStartDependencies
) {
this.startDependencies = {
npDataStart: npData,
savedObjectsClient,
embeddables,
navigation,
share,
dashboardConfig,
};
}

Expand Down
15 changes: 0 additions & 15 deletions src/legacy/core_plugins/kibana/public/home/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import { FeatureCatalogueRegistryProvider } from 'ui/registry/feature_catalogue';
import { npSetup, npStart } from 'ui/new_platform';
import chrome from 'ui/chrome';
import { HomePlugin, LegacyAngularInjectedDependencies } from './plugin';
Expand All @@ -44,26 +43,12 @@ async function getAngularDependencies(): Promise<LegacyAngularInjectedDependenci
};
}

let copiedLegacyCatalogue = false;

(async () => {
const instance = new HomePlugin();
instance.setup(npSetup.core, {
...npSetup.plugins,
__LEGACY: {
metadata: npStart.core.injectedMetadata.getLegacyMetadata(),
getFeatureCatalogueEntries: async () => {
if (!copiedLegacyCatalogue) {
const injector = await chrome.dangerouslyGetActiveInjector();
const Private = injector.get<IPrivate>('Private');
// Merge legacy registry with new registry
(Private(FeatureCatalogueRegistryProvider as any) as any).inTitleOrder.map(
npSetup.plugins.home.featureCatalogue.register
);
copiedLegacyCatalogue = true;
}
return npStart.plugins.home.featureCatalogue.get();
},
getAngularDependencies,
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/kibana/public/home/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ import {
import { UiStatsMetricType } from '@kbn/analytics';
import {
Environment,
FeatureCatalogueEntry,
HomePublicPluginSetup,
FeatureCatalogueEntry,
} from '../../../../../plugins/home/public';
import { KibanaLegacySetup } from '../../../../../plugins/kibana_legacy/public';

export interface HomeKibanaServices {
indexPatternService: any;
getFeatureCatalogueEntries: () => Promise<readonly FeatureCatalogueEntry[]>;
metadata: {
app: unknown;
bundleId: string;
Expand All @@ -58,6 +57,7 @@ export interface HomeKibanaServices {
uiSettings: IUiSettingsClient;
config: KibanaLegacySetup['config'];
homeConfig: HomePublicPluginSetup['config'];
directories: readonly FeatureCatalogueEntry[];
http: HttpStart;
savedObjectsClient: SavedObjectsClientContract;
toastNotifications: NotificationsSetup['toasts'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import { getServices } from '../kibana_services';

export const renderApp = async (element: HTMLElement) => {
const homeTitle = i18n.translate('kbn.home.breadcrumbs.homeTitle', { defaultMessage: 'Home' });
const { getFeatureCatalogueEntries, chrome } = getServices();
const directories = await getFeatureCatalogueEntries();
const { directories, chrome } = getServices();
chrome.setBreadcrumbs([{ text: homeTitle }]);

render(<HomeApp directories={directories} />, element);
Expand Down
6 changes: 4 additions & 2 deletions src/legacy/core_plugins/kibana/public/home/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import { KibanaLegacySetup } from '../../../../../plugins/kibana_legacy/public';
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public';
import {
Environment,
FeatureCatalogueEntry,
HomePublicPluginStart,
HomePublicPluginSetup,
FeatureCatalogueEntry,
} from '../../../../../plugins/home/public';

export interface LegacyAngularInjectedDependencies {
Expand Down Expand Up @@ -55,7 +55,6 @@ export interface HomePluginSetupDependencies {
devMode: boolean;
uiSettings: { defaults: UiSettingsState; user?: UiSettingsState | undefined };
};
getFeatureCatalogueEntries: () => Promise<readonly FeatureCatalogueEntry[]>;
getAngularDependencies: () => Promise<LegacyAngularInjectedDependencies>;
};
usageCollection: UsageCollectionSetup;
Expand All @@ -67,6 +66,7 @@ export class HomePlugin implements Plugin {
private dataStart: DataPublicPluginStart | null = null;
private savedObjectsClient: any = null;
private environment: Environment | null = null;
private directories: readonly FeatureCatalogueEntry[] | null = null;

setup(
core: CoreSetup,
Expand Down Expand Up @@ -100,6 +100,7 @@ export class HomePlugin implements Plugin {
environment: this.environment!,
config: kibanaLegacy.config,
homeConfig: home.config,
directories: this.directories!,
...angularDependencies,
});
const { renderApp } = await import('./np_ready/application');
Expand All @@ -110,6 +111,7 @@ export class HomePlugin implements Plugin {

start(core: CoreStart, { data, home }: HomePluginStartDependencies) {
this.environment = home.environment.get();
this.directories = home.featureCatalogue.get();
this.dataStart = data;
this.savedObjectsClient = core.savedObjects.client;
}
Expand Down
Loading

0 comments on commit a7a135f

Please sign in to comment.