Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Feb 1, 2021
2 parents 0473f5a + 688b918 commit c4d050e
Show file tree
Hide file tree
Showing 841 changed files with 22,037 additions and 9,463 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
# APM
/x-pack/plugins/apm/ @elastic/apm-ui
/x-pack/test/functional/apps/apm/ @elastic/apm-ui
/x-pack/test/apm_api_integration/ @elastic/apm-ui
/src/plugins/apm_oss/ @elastic/apm-ui
/src/apm.js @elastic/kibana-core @vigneshshanmugam
/packages/kbn-apm-config-loader/ @elastic/kibana-core @vigneshshanmugam
Expand All @@ -80,6 +81,7 @@
/x-pack/plugins/apm/server/lib/rum_client @elastic/uptime
/x-pack/plugins/apm/server/routes/rum_client.ts @elastic/uptime
/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts @elastic/uptime
/x-pack/test/apm_api_integration/tests/csm/ @elastic/uptime

# Beats
/x-pack/plugins/beats_management/ @elastic/beats
Expand All @@ -99,7 +101,7 @@

# Observability UIs
/x-pack/plugins/infra/ @elastic/logs-metrics-ui
/x-pack/plugins/fleet/ @elastic/ingest-management
/x-pack/plugins/fleet/ @elastic/fleet
/x-pack/plugins/observability/ @elastic/observability-ui
/x-pack/plugins/monitoring/ @elastic/stack-monitoring-ui
/x-pack/plugins/uptime @elastic/uptime
Expand Down
2 changes: 1 addition & 1 deletion .github/paths-labeller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- "src/plugins/bfetch/**/*.*"
- "Team:apm":
- "x-pack/plugins/apm/**/*.*"
- "Team:Ingest Management":
- "Team:Fleet":
- "x-pack/plugins/fleet/**/*.*"
- "x-pack/test/fleet_api_integration/**/*.*"
- "Team:uptime":
Expand Down
4 changes: 2 additions & 2 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ It also provides a stateful version of it on the start contract.
Content is fetched from the remote (https://feeds.elastic.co and https://feeds-staging.elastic.co in dev mode) once a day, with periodic checks if the content needs to be refreshed. All newsfeed content is hosted remotely.
|{kib-repo}blob/{branch}/src/plugins/presentation_util/README.md[presentationUtil]
|Utilities and components used by the presentation-related plugins
|{kib-repo}blob/{branch}/src/plugins/presentation_util/README.mdx[presentationUtil]
|The Presentation Utility Plugin is a set of common, shared components and toolkits for solutions within the Presentation space, (e.g. Dashboards, Canvas).
|{kib-repo}blob/{branch}/src/plugins/region_map/README.md[regionMap]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) &gt; [createIndexAliasNotFoundError](./kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md)

## SavedObjectsErrorHelpers.createIndexAliasNotFoundError() method

<b>Signature:</b>

```typescript
static createIndexAliasNotFoundError(alias: string): DecoratedError;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| alias | <code>string</code> | |

<b>Returns:</b>

`DecoratedError`

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) &gt; [decorateIndexAliasNotFoundError](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md)

## SavedObjectsErrorHelpers.decorateIndexAliasNotFoundError() method

<b>Signature:</b>

```typescript
static decorateIndexAliasNotFoundError(error: Error, alias: string): DecoratedError;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| error | <code>Error</code> | |
| alias | <code>string</code> | |

<b>Returns:</b>

`DecoratedError`

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) &gt; [isGeneralError](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md)

## SavedObjectsErrorHelpers.isGeneralError() method

<b>Signature:</b>

```typescript
static isGeneralError(error: Error | DecoratedError): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| error | <code>Error &#124; DecoratedError</code> | |

<b>Returns:</b>

`boolean`

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export declare class SavedObjectsErrorHelpers
| [createBadRequestError(reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createbadrequesterror.md) | <code>static</code> | |
| [createConflictError(type, id, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.createconflicterror.md) | <code>static</code> | |
| [createGenericNotFoundError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.creategenericnotfounderror.md) | <code>static</code> | |
| [createIndexAliasNotFoundError(alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.createindexaliasnotfounderror.md) | <code>static</code> | |
| [createInvalidVersionError(versionInput)](./kibana-plugin-core-server.savedobjectserrorhelpers.createinvalidversionerror.md) | <code>static</code> | |
| [createTooManyRequestsError(type, id)](./kibana-plugin-core-server.savedobjectserrorhelpers.createtoomanyrequestserror.md) | <code>static</code> | |
| [createUnsupportedTypeError(type)](./kibana-plugin-core-server.savedobjectserrorhelpers.createunsupportedtypeerror.md) | <code>static</code> | |
Expand All @@ -27,6 +28,7 @@ export declare class SavedObjectsErrorHelpers
| [decorateEsUnavailableError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateesunavailableerror.md) | <code>static</code> | |
| [decorateForbiddenError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateforbiddenerror.md) | <code>static</code> | |
| [decorateGeneralError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorategeneralerror.md) | <code>static</code> | |
| [decorateIndexAliasNotFoundError(error, alias)](./kibana-plugin-core-server.savedobjectserrorhelpers.decorateindexaliasnotfounderror.md) | <code>static</code> | |
| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratenotauthorizederror.md) | <code>static</code> | |
| [decorateRequestEntityTooLargeError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoraterequestentitytoolargeerror.md) | <code>static</code> | |
| [decorateTooManyRequestsError(error, reason)](./kibana-plugin-core-server.savedobjectserrorhelpers.decoratetoomanyrequestserror.md) | <code>static</code> | |
Expand All @@ -35,6 +37,7 @@ export declare class SavedObjectsErrorHelpers
| [isEsCannotExecuteScriptError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isescannotexecutescripterror.md) | <code>static</code> | |
| [isEsUnavailableError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isesunavailableerror.md) | <code>static</code> | |
| [isForbiddenError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isforbiddenerror.md) | <code>static</code> | |
| [isGeneralError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isgeneralerror.md) | <code>static</code> | |
| [isInvalidVersionError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isinvalidversionerror.md) | <code>static</code> | |
| [isNotAuthorizedError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotauthorizederror.md) | <code>static</code> | |
| [isNotFoundError(error)](./kibana-plugin-core-server.savedobjectserrorhelpers.isnotfounderror.md) | <code>static</code> | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<b>Signature:</b>

```typescript
protected handleSearchError(e: any, timeoutSignal: AbortSignal, options?: ISearchOptions): Error;
protected handleSearchError(e: KibanaServerError | AbortError, timeoutSignal: AbortSignal, options?: ISearchOptions): Error;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| e | <code>any</code> | |
| e | <code>KibanaServerError &#124; AbortError</code> | |
| timeoutSignal | <code>AbortSignal</code> | |
| options | <code>ISearchOptions</code> | |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

## SearchSource.fetch() method

Fetch this source and reject the returned Promise on error
> Warning: This API is now obsolete.
>
> Use fetch$ instead
>
Fetch this source and reject the returned Promise on error

<b>Signature:</b>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) &gt; [fetch$](./kibana-plugin-plugins-data-public.searchsource.fetch_.md)

## SearchSource.fetch$() method

Fetch this source from Elasticsearch, returning an observable over the response(s)

<b>Signature:</b>

```typescript
fetch$(options?: ISearchOptions): import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| options | <code>ISearchOptions</code> | |

<b>Returns:</b>

`import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>`

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export declare class SearchSource
| [createCopy()](./kibana-plugin-plugins-data-public.searchsource.createcopy.md) | | creates a copy of this search source (without its children) |
| [destroy()](./kibana-plugin-plugins-data-public.searchsource.destroy.md) | | Completely destroy the SearchSource. {<!-- -->undefined<!-- -->} |
| [fetch(options)](./kibana-plugin-plugins-data-public.searchsource.fetch.md) | | Fetch this source and reject the returned Promise on error |
| [fetch$(options)](./kibana-plugin-plugins-data-public.searchsource.fetch_.md) | | Fetch this source from Elasticsearch, returning an observable over the response(s) |
| [getField(field, recurse)](./kibana-plugin-plugins-data-public.searchsource.getfield.md) | | Gets a single field from the fields |
| [getFields()](./kibana-plugin-plugins-data-public.searchsource.getfields.md) | | returns all search source fields |
| [getId()](./kibana-plugin-plugins-data-public.searchsource.getid.md) | | returns search source id |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Constructs a new instance of the `SearchTimeoutError` class
<b>Signature:</b>

```typescript
constructor(err: Error, mode: TimeoutErrorMode);
constructor(err: Record<string, any>, mode: TimeoutErrorMode);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| err | <code>Error</code> | |
| err | <code>Record&lt;string, any&gt;</code> | |
| mode | <code>TimeoutErrorMode</code> | |

9 changes: 4 additions & 5 deletions docs/setup/upgrade/upgrade-migrations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@ Saved objects are stored in two indices:
* `.kibana_{kibana_version}_001`, or if the `kibana.index` configuration setting is set `.{kibana.index}_{kibana_version}_001`. E.g. for Kibana v7.12.0 `.kibana_7.12.0_001`.
* `.kibana_task_manager_{kibana_version}_001`, or if the `xpack.tasks.index` configuration setting is set `.{xpack.tasks.index}_{kibana_version}_001` E.g. for Kibana v7.12.0 `.kibana_task_manager_7.12.0_001`.

The index aliases `.kibana` and `.kibana_task_manager` will always point to the most up-to-date version indices.
The index aliases `.kibana` and `.kibana_task_manager` will always point to
the most up-to-date saved object indices.

The first time a newer {kib} starts, it will first perform an upgrade migration before starting plugins or serving HTTP traffic. To prevent losing acknowledged writes old nodes should be shutdown before starting the upgrade. To reduce the likelihood of old nodes losing acknowledged writes, {kib} 7.12.0 and later will add a write block to the outdated index. Table 1 lists the saved objects indices used by previous versions of {kib}.

.Saved object indices and aliases per {kib} version
[options="header"]
[cols="a,a,a"]
|=======================
|Upgrading from version | Outdated index (alias) | Upgraded index (alias)
| 6.0.0 through 6.4.x | `.kibana` 1.3+^.^| `.kibana_7.12.0_001`
(`.kibana` alias)
|Upgrading from version | Outdated index (alias)
| 6.0.0 through 6.4.x | `.kibana`

`.kibana_task_manager_7.12.0_001` (`.kibana_task_manager` alias)
| 6.5.0 through 7.3.x | `.kibana_N` (`.kibana` alias)
Expand Down
43 changes: 42 additions & 1 deletion docs/user/alerting/alert-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This section covers stack alerts. For domain-specific alert types, refer to the
Users will need `all` access to the *Stack Alerts* feature to be able to create and edit any of the alerts listed below.
See <<kibana-feature-privileges, feature privileges>> for more information on configuring roles that provide access to this feature.

Currently {kib} provides one stack alert: the <<alert-type-index-threshold>> type.
Currently {kib} provides two stack alerts: <<alert-type-index-threshold>> and <<alert-type-es-query>>.

[float]
[[alert-type-index-threshold]]
Expand Down Expand Up @@ -112,6 +112,47 @@ You can interactively change the time window and observe the effect it has on th
[role="screenshot"]
image::images/alert-types-index-threshold-example-comparison.png[Comparing two time windows]

[float]
[[alert-type-es-query]]
=== ES query

The ES query alert type is designed to run a user-configured {es} query over indices, compare the number of matches to a configured threshold, and schedule
actions to run when the threshold condition is met.

[float]
==== Creating the alert

An ES query alert can be created from the *Create* button in the <<alert-management, alert management UI>>. Fill in the <<defining-alerts-general-details, general alert details>>, then select *ES query*.

[role="screenshot"]
image::images/alert-types-es-query-select.png[Choosing an ES query alert type]

[float]
==== Defining the conditions

The ES query alert has 4 clauses that define the condition to detect.

[role="screenshot"]
image::images/alert-types-es-query-conditions.png[Four clauses define the condition to detect]

Index:: This clause requires an *index or index pattern* and a *time field* that will be used for the *time window*.
ES query:: This clause specifies the ES DSL query to execute. The number of documents that match this query will be evaulated against the threshold
condition. Aggregations are not supported at this time.
Threshold:: This clause defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The number of documents that match the specified query is compared to this threshold.
Time window:: This clause determines how far back to search for documents, using the *time field* set in the *index* clause. Generally this value should be set to a value higher than the *check every* value in the <<defining-alerts-general-details, general alert details>>, to avoid gaps in detection.

[float]
==== Testing your query

Use the *Test query* feature to verify that your query DSL is valid.

When your query is valid:: Valid queries will be executed against the configured *index* using the configured *time window*. The number of documents that
match the query will be displayed.

[role="screenshot"]
image::images/alert-types-es-query-valid.png[Test ES query returns number of matches when valid]

When your query is invalid:: An error message is shown if the query is invalid.

[role="screenshot"]
image::images/alert-types-es-query-invalid.png[Test ES query shows error when invalid]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
"@storybook/addon-essentials": "^6.0.26",
"@storybook/addon-knobs": "^6.0.26",
"@storybook/addon-storyshots": "^6.0.26",
"@storybook/addon-docs": "^6.0.26",
"@storybook/components": "^6.0.26",
"@storybook/core": "^6.0.26",
"@storybook/core-events": "^6.0.26",
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export async function emptyKibanaIndexAction({

await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await migrateKibanaIndex({ client, kbnClient });
return stats;
stats.createdIndex('.kibana');
return stats.toJSON();
}
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class EsArchiver {
* @return Promise
*/
async emptyKibanaIndex() {
await emptyKibanaIndexAction({
return await emptyKibanaIndexAction({
client: this.client,
log: this.log,
kbnClient: this.kbnClient,
Expand Down
8 changes: 5 additions & 3 deletions packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ export async function migrateKibanaIndex({
*/
async function fetchKibanaIndices(client: Client) {
const kibanaIndices = await client.cat.indices({ index: '.kibana*', format: 'json' });
const isKibanaIndex = (index: string) => /^\.kibana(:?_\d*)?$/.test(index);
const isKibanaIndex = (index: string) =>
/^\.kibana(:?_\d*)?$/.test(index) ||
/^\.kibana(_task_manager)?_(pre)?\d+\.\d+\.\d+/.test(index);
return kibanaIndices.map((x: { index: string }) => x.index).filter(isKibanaIndex);
}

Expand All @@ -103,7 +105,7 @@ export async function cleanKibanaIndices({

while (true) {
const resp = await client.deleteByQuery({
index: `.kibana`,
index: `.kibana,.kibana_task_manager`,
body: {
query: {
bool: {
Expand All @@ -115,7 +117,7 @@ export async function cleanKibanaIndices({
},
},
},
ignore: [409],
ignore: [404, 409],
});

if (resp.total !== resp.deleted) {
Expand Down
35 changes: 35 additions & 0 deletions packages/kbn-legacy-logging/src/setup_logging.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/

import { Server } from '@hapi/hapi';
import { reconfigureLogging, setupLogging } from './setup_logging';
import { LegacyLoggingConfig } from './schema';

describe('reconfigureLogging', () => {
test(`doesn't throw an error`, () => {
const server = new Server();
const config: LegacyLoggingConfig = {
silent: false,
quiet: false,
verbose: true,
events: {},
dest: '/tmp/foo',
filter: {},
json: true,
rotate: {
enabled: false,
everyBytes: 0,
keepFiles: 0,
pollingInterval: 0,
usePolling: false,
},
};
setupLogging(server, config, 10);
reconfigureLogging(server, { ...config, dest: '/tmp/bar' }, 0);
});
});
2 changes: 1 addition & 1 deletion packages/kbn-legacy-logging/src/setup_logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export function reconfigureLogging(
opsInterval: number
) {
const loggingOptions = getLoggingConfiguration(config, opsInterval);
(server.plugins as any)['@elastic/good'].reconfigure(loggingOptions);
(server.plugins as any).good.reconfigure(loggingOptions);
}
Loading

0 comments on commit c4d050e

Please sign in to comment.