Commit graph

31989 commits

Author SHA1 Message Date
Pablo Machado
6db79db1e0
[Security Solutions] Update Events/alerts table to use FieldSpec for CellActions (#161361)
EPIC: https://github.com/elastic/kibana/issues/144943

## Summary

Update Events/alerts table to provide `CellActions` with a complete
`FieldSpec`object from DataView

### Affected pages:
* Alerts page
* Security Dashboards
* Rule preview
* Host events
* Users events

### How to test it
Use CellActions on one of the affected pages.




### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 16:57:04 +02:00
Lisa Cawley
ff6099eb3f
[DOCS] Add more automated screenshots for security cases (#161485) 2023-07-10 07:50:38 -07:00
Juan Pablo Djeredjian
31b28a0660
[Security Solution] Allow only users with 'all' privileges to install and upgrade prebuilt rules (#161454)
Fixes: https://github.com/elastic/kibana/issues/161443

## Summary

### When user doesn't have write permission:
- Disables "Add Elastic rules" button and removes Rule Updates tab

![image](a173f18f-9b6b-4c9a-bf5f-207af13e24cb)

- Disables buttons to individually install rules, install selected rules
and install all rules

![image](4d24d440-17f4-4d1d-96fc-4eb07914cff0)

- Disables buttons to individually upgrade rules, upgrade selected rules
and upgrade all rules

![image](036236c1-dac0-42b8-87e5-0244d9ead281)

### `_perform` endpoints
- Returns 403 when installing all rules or specific rules

![image](adc20409-ff09-42e5-aa33-0f1ec0df46f6)

![image](d1faf778-d857-458e-afeb-7c573e7bf4d3)

- Returns 403 when upgrading all rules or specific rules

![image](b21ffaa7-416c-402a-a157-12735f28e689)

![image](b8dfecc6-4cfe-462c-9e9c-6344f59aa2d5)


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Dmitrii <dmitrii.shevchenko@elastic.co>
2023-07-10 16:35:17 +02:00
Carlos Crespo
4baeafe4e6
[Infrastructure UI] Lens Embeddable attributes builder refactor (#161281)
relates to [#160381](https://github.com/elastic/kibana/issues/160381)
closes [#161432](https://github.com/elastic/kibana/issues/161432)

## Summary

This pull request aims to enhance the usage of Lens Embeddable by
introducing abstractions that simplify the creation of the necessary
data structures for rendering charts. The goal is to improve the DX by
providing clearer and more intuitive interfaces.

More details in the
[README.md](62a9ef70e6/x-pack/plugins/infra/public/common/visualizations/lens/README.md)

### For reviewers

- The majority of the changes are concentrated in the
`common/visualizations` directory. The `formulas/host` files have been
modified to only contain the formula itself. The formulas are now
designed to be independent of specific chart styles.

- The `use_lens_attributes` hook has been modified to receive the
essential information. Previously, it had knowledge of host formulas,
but now it accepts an abstracted chart representation and returns the
JSON object accordingly.

- Chart-specific style configurations have been moved to the chart usage
component in the `tile` and `metric_chart` components.


### How to test 

- Start a local Kibana instance
- Navigate to `Infrastructure` > `Hosts`
- Check all charts and navigate to Lens.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 16:06:04 +02:00
Clint Andrew Hall
f4b1011641
Merge branch 'main' into kibana_context 2023-07-10 15:57:23 +02:00
Sloane
9f2a75be3b
[Serverless Search] Expanded unit testing (#161356)
## Summary

Sets up unit testing for react components.

Unit testing of server-side components already implemented.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-07-10 09:10:25 -04:00
Miriam
13da9495a9
[APM] Hide storage explorer from global search in serverless (#161155)
Closes https://github.com/elastic/kibana/issues/159558

### What was done
Added feature flag in deep linking to hide Storage Explorer from the
global search in serverless

### Before

<img width="1113" alt="Screenshot 2023-07-04 at 09 25 11"
src="6f4ecfad-8067-4c40-8478-15550463f3d0">

### After

<img width="1113" alt="Screenshot 2023-07-04 at 09 26 13"
src="2d33214b-4d30-4836-a6b2-c6878ef1ba29">
2023-07-10 13:30:32 +02:00
Walter Rafelsberger
fc4edd68a5
[ML] Transforms: Reduce rerenders and multiple fetches of source index on transform wizard load. (#160979)
Adds checks to avoid unnecessary initial rerenders and refetches of data
when loading the transform wizard. This reduces rerenders from 14 to 11
and more importantly the request to fetch index data is triggered only
once instead of three times. One of the requests even triggered an error
which could briefly trigger a callout on slower connections.
2023-07-10 12:37:19 +02:00
Julia Rechkunova
ea53763028
[UnifiedFieldList][Discover] Create a high level unified field list building block (#160397)
- Closes https://github.com/elastic/kibana/issues/145162 
- Closes https://github.com/elastic/kibana/issues/147884

## Summary

This PR creates a wrapper/container component (building block) for
unified field list subcomponents:

93acc6f707/packages/kbn-unified-field-list/README.md (L5)

Available customization options are listed here:
93acc6f707/packages/kbn-unified-field-list/src/types.ts (L116)

It's now integrated [into
Discover](93acc6f707/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar_responsive.tsx (L373))
and [into example
plugin](93acc6f707/examples/unified_field_list_examples/public/field_list_sidebar.tsx (L84)).
Usage of unified field list subcomponents and hooks stays unchanged in
Lens plugin as it requires more complex customization (for example Lens
uses IndexPattern/IndexPatternField types instead of data view types).

Also this PR allows to disable multifields grouping and select a variant
(responsive, list only, button only) via
`UnifiedFieldListSidebarContainer` properties.

There should no visual changes on Discover and Lens pages. Unified Field
List Examples plugin will get the same sidebar UI as it's on Discover.

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-07-10 12:18:40 +02:00
Janki Salvi
d8c8b7b0f0
[Cases] UI validation for total number of comment characters (#161357)
## Summary

This PR adds UI validation for comments maximum length. 
It shows error message and disables save button when the comment exceeds
30k characters while

- **Adding a new comment**


![image](42cafdfc-6e88-4bf9-ab93-9fb61de6eb78)

- **Updating an existing comment**


![image](1d8408d1-c1cd-404c-b1ba-f4ecb94c4225)


### Checklist

Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 10:09:23 +02:00
Dzmitry Lemechko
ac8d73ac6d
[ftr] fix test users for serverless (#161280)
## Summary

This PR fixes few issues occurring while running FTR API tests against
actual serverless project.

How to run:
```
TEST_CLOUD=1 ES_SECURITY_ENABLED=1 NODE_TLS_REJECT_UNAUTHORIZED=0 TEST_ES_URL=<your_es_url_with_credentials> TEST_KIBANA_URL=<your_es_url_with_credentials> node  --no-warnings scripts/functional_test_runner --es-version=8.9.0 --config x-pack/test_serverless/api_integration/test_suites/search/config.ts --bail
```

The first error is faced during Elasticsearch version validation

```
ERROR Error: attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ResponseError: {"ok":false,"message":"Unknown resource."}
          at SniffingTransport.request (/Users/dmle/github/kibana/node_modules/@elastic/transport/src/Transport.ts:535:17)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at Client.InfoApi [as info] (/Users/dmle/github/kibana/node_modules/@elastic/elasticsearch/src/api/api/info.ts:60:10)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:129:16)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:131:13)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
```

Since there is no version term in case of serverless, we can skip
version check by using newly added to FTR schema `serverless` property
(`false` by default). It is set to `true` in root FTR config
`/shared/config.base`.

The next error is related to ESArchiver relying on `ES` FTR service to
provide ESClient.

```
ResponseError: security_exception
   │ 	Root causes:
   │ 		security_exception: unable to authenticate user [system_indices_superuser] for REST request [/kibana_sample_data_flights]
```

It is fixed by using the default user (from host url) instead of
`system_indices_superuser` we use in stateful run.
2023-07-10 10:09:07 +02:00
Miriam
106bb331e0
[APM] Remove usage of refresh=true in agent configuration and custom links (#161346)
Closes https://github.com/elastic/kibana/issues/158135
2023-07-10 07:49:29 +02:00
Gil Raphaelli
73212493a9
Update elastic agent installation script (#161104)
* require bash and curl
* support arm/aarch
* support macOS
* disable resuming elastic agent download
2023-07-08 06:36:52 -07:00
Xavier Mouligneau
8ef3b3dd85
[RAM] KQL search bar for rules (#158106)
## Summary

Allow KQL bar working with saved objects.


![KQL-for-rules](80bb2498-78a8-4124-8d03-e771015eb103)


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lukas Olson <olson.lukas@gmail.com>
2023-07-07 19:40:58 -07:00
Gabriel Landau
203188db9a
Defend/Endpoint Advanced Policy Options for 8.9 (#161302)
## Summary

New advanced Endpoint/Defend options. See their descriptions for
details.

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 18:16:58 -07:00
Lukas Olson
4b7d18b5c3
[bfetch] Use versioned router (#161317)
## Summary

Part of https://github.com/elastic/kibana/issues/157095.

Uses the new versioned router capabilities for the bfetch plugin.

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 16:48:02 -07:00
Adam Demjen
86fa655990
[8.10] [ESRE] Support attaching ELSER pipeline (#161388)
## Summary

Attaching ELSER pipelines to an index was disabled when ELSER pipelines
were introduced. This PR enables this feature with the following logic:
- An ELSER pipeline is selectable if all the source fields in its
`fieldMapping` configuration are present in the index. Otherwise it's
disabled in the dropdown with a message indicating which fields are
missing.
- When an ELSER pipeline is selected for attachment to an index, the
field configuration screen shows a read-only version of the field
mappings. The modification widgets (field selector dropdown, Add button,
delete button in the list) are hidden in this mode.

ELSER pipeline is selectable:
![Screenshot 2023-07-06 at 18 16
54](3650c0fb-7ae1-4639-bcf6-94fe488f35c6)

ELSER pipeline is not selectable if source fields are missing from the
index mapping:
![Screenshot 2023-07-06 at 18 21
07](a94c23d8-d212-4628-b1e5-16012cbc989c)

Field configuration panel in read-only mode:
![Screenshot 2023-07-07 at 11 14
10](ee663499-2193-4e91-a81b-b3fe418a2780)

### Checklist
- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 11:48:01 -07:00
Faisal Kanout
f0bd9bfb89
[AO] update data-test-subj for the Threshold rule-related components to collect telemetry. (#161368)
## Summary

It fixes #161366
2023-07-07 11:08:45 -07:00
Christos Nasikas
67fc8333e7
[Actions] Set system actions on Kibana start (#160983)
## Summary

This PR:

- Adds the ability to create system action types
- Creates system connectors on Kibana `start` from the system action
types
- Prevents system action to be created/updated/deleted
- Return system actions from the get/getAll endpoints

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 10:39:29 -07:00
Shahzad
552a3a6553
[Synthetics] Fixed a label for lens viz in synthetics apps (#161446)
## Summary

Some refactor broke our labels, added a test case to make sure it's part
of e2e tests.

### After

<img width="1456" alt="image"
src="23f8cd56-ad4b-4c9d-97e7-2681c963406d">

### Before

<img width="1495" alt="image"
src="f835742b-d506-4beb-b68f-1d51d164ad96">
2023-07-07 19:19:53 +02:00
Luke
74e3eca687
[Security Solution] Clean up expandable flyout props (#160628)
## Summary

This PR removes `onClose` prop from the expandable flyout as it is not
necessary anymore

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 10:16:21 -07:00
Lisa Cawley
9791c47fa2
[DOCS] Add screenshot automation for security cases (#161412) 2023-07-07 09:31:15 -07:00
Shahzad
0fe62fba0b
[Synthetics] Fix TLS alert recovery (#161254)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Abdul Wahab Zahid <awahab07@yahoo.com>
2023-07-07 09:01:29 -07:00
Xavier Mouligneau
bed184b829
[RAM] Alert table all column fix 2 (#161054)
https://github.com/elastic/kibana/pull/160455

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 09:57:22 -06:00
Jeramy Soucy
4fc4ded06b
Unskips tests related to no_shard_available failures (#161109)
Closes
#155723,#155846,#156045,#156041,#156074,#156130,#156151,#156739,#157673,#156422,#156998,#156922,#156921,#157452,#158366,#158586,#158711

## Summary

Issue was resolved by PR #160584. This PR unskips saved object tests
documented as skipped in #158918.

### Testing
Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2543
2023-07-07 11:34:47 -04:00
jennypavlova
74a786084f
[infra UI] Add overview tab with the first section to asset details view (#160924)
Closes  #160376
## Summary

This PR adds the initial version of the Overview tab including KPI tiles
and metadata summary.
<img width="865" alt="image"
src="36b62899-64e8-4359-a7f5-e09a2a300bba">

The storybook is not showing the lens charts as it will be hard because
of the dependencies (we should consider if it is worth the effort to add
them there in the future) The other parts look Ok:
<img width="2550" alt="image"
src="348b868b-9ed9-4b59-b02c-cb1e91eecb5a">


## Next steps 👣 
There are still some parts that can be addressed separately when other
parts are ready:
- The date is currently relying on the host date picker (passed as an
override) which can be fixed once the date picker is added to the page

## Testing 
- Go to host view and open the flyout - the default tab is now overview
tab
- Hint: to see the chart movements better pick a wider time range (5
days for example)
   
<img width="1468" alt="image"
src="d31faf71-5beb-48f2-b20a-7dfcacd52325">

- Show all button in the metadata section should open the metadata tab
- Storybook: Use `yarn storybook infra` to run the storybook and check
both `Page` and `Flyout`
2023-07-07 17:14:04 +02:00
Gerard Soldevila
79f7bb45fd
Attempt to fix flaky tests after split migration (#159397)
## Summary
Addresses root cause of https://github.com/elastic/kibana/issues/158918

Underlying cause is that _esArchiver_ is messing up with the SO indices
whilst Kibana is already running.

This can cause some asynchronous calls made by Kibana (e.g. `GET
/.kibana_8.8.0/telemetry:telemetry`) to hit ES at the exact time where
the underlying SO indices are **just** recreated, causing the error
described in the related issue.

The idea of the fix is to delete `mappings.json`, used by _esArchiver_
to create the SO indices. This way, _esArchiver_ will use existing SO
indices instead (aka the "official" ones, created by Kibana at startup),
thus avoiding the problem altogether.

As a side effect:

- Documents in `data.json` must be updated so that they are correctly
inserted.
- The different FTR tests must make sure the SO indices are empty before
inserting those documents (done in the `before(), beforeEach()`
statements).
2023-07-07 17:05:42 +02:00
Janki Salvi
cd24dc2254
[Cases] limit number of attachments that can be created using the bulk create API (#161451)
Connected to https://github.com/elastic/kibana/issues/146945

## Summary

| Description  | Limit | Done? | Documented?
| ------------- | ---- | :---: | ---- |
| Total number of attachments that can be created using the bulk create
API | 100 |  | No |

### Checklist

Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 16:42:03 +02:00
Brandon Morelli
3ced121be0
[APM] UX text review (#161400)
## Summary

@gchaps and I met to review text on some APM UI pages. Outcomes:

1. Service **m**ap or Service **M**ap — there is inconsistency in the
APM UI with how we refer to Service maps. In some cases, we use title
case (Service Map). In others, we use sentence case (Service map). As
per the [EUI writing
guidelines](https://eui.elastic.co/#/guidelines/writing/guidelines#capitalization),
we should use title case for product features.
2. Storage **e**xplorer or Storage **E**xplorer — same story here. We
use title case sometimes and sentence case others. We should use title
case as this is a product feature.
3. Various text enhancements and changes.
2023-07-07 07:41:46 -07:00
Antonio
ec6bcd69b8
[Cases] Total users returned by suggested users API (#161329)
Connected to https://github.com/elastic/kibana/issues/146945

## Summary

| Description  | Limit | Done? | Documented?
| ------------- | ---- | :---: | ---- |
| Total number of users returned by suggest users API | 10 |
 | No (internal) |

### Checklist

Delete any items that are not applicable to this PR.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-07-07 15:53:59 +02:00
Cauê Marcondes
3eb387c7dd
[Profiling] fixing api endpoint (#161387)
Using internal api `/internal/profiling/setup/es_resources`
2023-07-07 06:36:46 -07:00
Stratoula Kalafateli
3b67450d41
[Lens playground] Removes deprecated eui components (#161437)
## Summary

Closes https://github.com/elastic/kibana/issues/161423

Removes the deprecated EUI components.
2023-07-07 16:01:55 +03:00
Juan Pablo Djeredjian
61fa0f543e
[Security Solution] Set immutable param to true when updating prebuilt rules (#161331)
Fixes: https://github.com/elastic/kibana/issues/161305

## Summary

- Passes a new `immutable` params to the `upgradeRule` method that is
used when upgrading rules.
- Looks like we had a longstanding bug here in which rule updates of
rule types that changed the type of the rule were overwriting the
`immutable` prop to `false`. (Actually, those rules were deleted and
recreated with `immutable: false`)
- This was causing the `fetchAllInstalledRules` method of our
`ruleObjectsClient` NOT to retrieve these rules when they were already
installed.
- Since our installation `_review` and `_perform` endpoint depends on
this client, these rules that had had their types updated were being
incorrectly listed as available for installation.

## Testing

Repeat testing steps laid out in:
https://github.com/elastic/kibana/issues/161305

Rules shouldn't be duplicated.


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2023-07-07 14:06:28 +02:00
Tiago Costa
65fed0982a
skip flaky suite (#157740) 2023-07-07 12:32:42 +01:00
Cristina Amico
36e7d600ce
[Fleet] Fix exception in agents list when units field is missing from components (#161360)
## Summary
Fix an issue found in 8.8.2 with `8.7.1` inactive agents. The agents
list endpoint was returning an exception, after some investigation it
was found that the issue was a missing `units` property in the
components field of the agents.

This was a very specific edge case and in fact I could not reproduce
locally, but it still happened in a minority of cases after upgrading to
8.8.2.

The agents in this case have components that look like this:
```
 "components": [
            {
              "id": "http/metrics-monitoring",
              "type": "http/metrics",
              "message": "Starting",
              "status": "STARTING"
            },
  ...
]
```
But this property was typed as mandatory so we didn't check for
undefined. The actual bug was tracked here:

2070836060/x-pack/plugins/fleet/server/services/agents/helpers.ts (L50)

and was causing this error:


607b5aed-155b-4509-896a-ada7507e4dc3

I also updated the type to have `units` as optional and fixed a couple
of other places where this could cause issues.

### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 12:13:37 +02:00
Shahzad
6b52658af7
[Synthetics] Removing passing of error object to logger.error as meta parameter (#161276) 2023-07-07 11:53:27 +02:00
Shahzad
42bc85f91f
[Synthetics] Private locations , update fleet permissions callout (#161351) 2023-07-07 11:51:50 +02:00
Jedrzej Blaszyk
94e850dcb5
[Enterprise Search] Add Google Drive connector tile to content UI (#161359)
## Summary

This adds Google Drive connector tile to Enterprise Search.

### Preview

Google drive connector documentation link:
https://www.elastic.co/guide/en/enterprise-search/master/connectors-google-drive.html

Tile view:

<img width="1681" alt="Screenshot 2023-07-06 at 16 18 33"
src="805dea1c-70ca-46f8-b4df-78802a614b37">


Google Drive configuration - we only require service account JSON:

<img width="869" alt="Screenshot 2023-07-06 at 16 20 03"
src="ea50966f-64a6-49ed-a2e0-f697cb870e9c">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 10:51:11 +02:00
Stratoula Kalafateli
fde953907c
[TextBased] Allow inline editing from dashboards (#161146)
## Summary

Part of https://github.com/elastic/kibana/issues/158802

For panels created from Discover with text based languages, not navigate
to Lens but open a flyout instead.


![sql](489402ac-dcdb-468b-89b9-a84f4c4f2ca5)


Follow up PR: 
- Remove the SQL option from Lens dataview picker and move the FTs in
Discover/Dashboard

Note:
- Changing the query on the dashboard level is going to be added in 8.11

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 11:20:45 +03:00
Kibana Machine
3495720e42 skip failing test suite (#161324) 2023-07-07 04:15:23 -04:00
Felix Barnsteiner
5c0f034e75
Clarify documentation for the observability:enableComparisonByDefault setting (#161372)
The previous description
> Enables the comparison feature in the APM app.

makes it sound like the entire feature would be disabled when setting
the option to false.
2023-07-07 09:52:47 +02:00
Drew Tate
e9e5c3cdcd
[Lens] warn user before leaving editor after creating new library annotation group (#161307) 2023-07-07 00:03:21 -07:00
Antonio
2774812001
[Cases] Guardrails getConnectors API (#161282)
Connected to https://github.com/elastic/kibana/issues/146945

## Summary

| Description  | Limit | Done? | Documented?
| ------------- | ---- | :---: | ---- |
| Total number of supported connectors returned | 1000 |
 | Yes |

### Checklist

Delete any items that are not applicable to this PR.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Release Notes

The getConnectors API will now limit the number of supported connectors
returned to 1000.
2023-07-07 08:50:47 +02:00
Tim Sullivan
bc09b1e01f
[Global Search Bar] Ensure the search controls are visible in low DPI screens (#161398)
## Summary

Closes https://github.com/elastic/kibana/issues/154415 by applying the
fix suggested by Cee Chen.

<img width="859" alt="image"
src="6d57effd-f4c8-43ec-a6ab-beb89218a885">

<img width="1715" alt="image"
src="8b750af7-cb4a-49cb-b1ba-c9621f88ccbb">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-07-06 21:02:46 -07:00
Jatin Kathuria
75bd6dd854
[Security Solution][Security Assistant] Fixes relationship between system prompts & conversations (#161039)
## Summary
This PR handles bugs 
- elastic/security-team#6977 
- https://github.com/elastic/security-team/issues/6978 
- elastic/security-team#6979.

Currently, below operations between System Prompts and Conversarions do
not work.

1. When a prompt is set as default for all conversation, it should be
automatically selected for any new conversation user creates.
2. When a new prompt is creates and set as default for all conversation,
it should be automatically selected for any new conversation user
creates.
3. When a prompt is edited such that, it is default for only certain
conversation, it should be automatically selected for that conversation.
4. When a prompt is edited such that conversations are removed to have
that default prompt, it should be automatically removed from
conversation default system prompt list.

In addition to above scenarios, this PR also handles one more bug.

Consider below interface of Conversation which has a property
`apiConfig.defaultSystemPrompt` is of type Prompt. It has been changed
from `defaultSystemPrompt?: Prompt` to `defaultSystemPrompt?: string`
where it will store `promptId` instead of complete prompt.

The current model was posing a problem where, if a prompt was updated,
all its copies in `Conversation` were needed to be updated leading to
inconsistencies. This is now resolved.

```typescript
export interface Conversation {
  apiConfig: {
    connectorId?: string;
    defaultSystemPrompt?: Prompt;
    provider?: OpenAiProviderType;
  };
  id: string;
  messages: Message[];
  replacements?: Record<string, string>;
  theme?: ConversationTheme;
  isDefault?: boolean;
}

```
2023-07-06 15:09:49 -07:00
Tim Sullivan
f82588ba5e
[Serverless] Support banner header (#160912)
## Summary

Closes https://github.com/elastic/kibana/issues/160052

This PR adds support for the header banner in serverless projects. 
<img width="1437" alt="image"
src="c950bbe7-46bb-4b82-b9ee-406aef7748dc">

**NOTE:** This PR adds support for the header banner by applying the
same techniques as in the "classic" layout: special class names of
`header__bar`/`header_firstBar`/`header__secondBar`. The effect is the
"header action menu" bar, which is an optional 2nd bar in the chrome
header, works better after this change when it is always visible. This
is a temporary issue that unblocks the header banner, and fixes other
overlapping issues with the current project layout stylings.

_As followup work_, the @elastic/appex-sharedux team will investigate
converting the Kibana page template to the new
[EuiPageTemplate](https://elastic.github.io/eui/#/templates/page-template/examples)
which supports horizontal sections of a page that have dynamic height --
we need this for the dynamic presence of the header banner, and the
intended dynamic presence of the header action menu.

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-07-06 14:43:26 -07:00
Tim Sullivan
9ce9b88a22
[Reporting/CSV] increase max size bytes default to 250mb (#161318)
## Summary

Closes https://github.com/elastic/kibana/issues/159514
2023-07-06 12:52:18 -07:00
Bree Hall
4cf630bfec
Upgrade EUI to 83.0.0 (#160813)
`eui@82.1.0`  `83.0.0`

⚠️ The biggest change in this PR by far is the `EuiButtonEmpty` Emotion
conversion, which changes the DOM structure of the button slightly as
well as several CSS classes around it.

EUI has attempted to convert any custom EuiButtonEmpty CSS overrides
where possible, but would super appreciate it if CODEOWNERS checked
their touched files. If anything other than a snapshot or test was
touched, please double check the display of your button(s) and confirm
everything still looks shipshape. Feel free to ping us for advice if
not.

---

## [`83.0.0`](https://github.com/elastic/eui/tree/v83.0.0)

**Bug fixes**

- Fixed `EuiPaginationButton` styling affected by `EuiButtonEmpty`'s
Emotion conversion ([#6893](https://github.com/elastic/eui/pull/6893))

**Breaking changes**

- Removed `isPlaceholder` prop from `EuiPaginationButton`
([#6893](https://github.com/elastic/eui/pull/6893))

## [`82.2.1`](https://github.com/elastic/eui/tree/v82.2.1)

- Updated supported Node engine versions to allow Node 16, 18 and >=20
([#6884](https://github.com/elastic/eui/pull/6884))

## [`82.2.0`](https://github.com/elastic/eui/tree/v82.2.0)

- Updated EUI's SVG icons library to use latest SVGO v3 optimization
([#6843](https://github.com/elastic/eui/pull/6843))
- Added success color `EuiNotificationBadge`
([#6864](https://github.com/elastic/eui/pull/6864))
- Added `badgeColor` prop to `EuiFilterButton`
([#6864](https://github.com/elastic/eui/pull/6864))
- Updated `EuiBadge` to use CSS-in-JS for named colors instead of inline
styles. Custom colors will still use inline styles.
([#6864](https://github.com/elastic/eui/pull/6864))

**CSS-in-JS conversions**

- Converted `EuiButtonGroup` and `EuiButtonGroupButton` to Emotion
([#6841](https://github.com/elastic/eui/pull/6841))
- Converted `EuiButtonIcon` to Emotion
([#6844](https://github.com/elastic/eui/pull/6844))
- Converted `EuiButtonEmpty` to Emotion
([#6863](https://github.com/elastic/eui/pull/6863))
- Converted `EuiCollapsibleNav` and `EuiCollapsibleNavGroup` to Emotion
([#6865](https://github.com/elastic/eui/pull/6865))
- Removed Sass variables `$euiCollapsibleNavGroupLightBackgroundColor`,
`$euiCollapsibleNavGroupDarkBackgroundColor`, and
`$euiCollapsibleNavGroupDarkHighContrastColor`
([#6865](https://github.com/elastic/eui/pull/6865))

---------

Co-authored-by: Cee Chen <constance.chen@elastic.co>
Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-06 12:46:55 -07:00
Zacqary Adam Xeper
0dc73122a5
[RAM] Move maintenance window callout to @kbn/alerts-ui-shared package (#160678)
## Summary

Moves the Security Solution's `MaintenanceWindowCallout` into a shared
KBN package to make it more accessible by other plugins.

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-06 12:34:55 -07:00
Milton Hultgren
bcb1649f29
[monitoring] Rewrite CPU usage rule to improve accuracy (#159351)
Fixes #116128

# Summary

This PR changes how the CPU Usage Rule calculates the usage percentage
for containerized clusters.

Based on the comment
[here](https://github.com/elastic/kibana/issues/116128#issuecomment-1117578705),
my understanding of the issue was that because we were using a
`date_histogram` to grab the values we could sometimes run into issues
around how `date_histogram` rounds the time range and aligns it towards
the start rather than the end, causing the last bucket to be incomplete,
this is aggravated by the fact that we make the fixed duration of the
histogram the size of the lookback window.

I took a slightly different path for the rewrite, rather than using the
derivative I just look at the usage across the whole range using a
simple delta.

This has a glaring flaw in that it cannot account for the limits
changing within the lookback window (going higher/lower or set/unset),
which we will have to try to address in
https://github.com/elastic/kibana/issues/160905. The changes in this PR
should make the situation better in the other cases and it makes clear
when the limits have changed by firing alerts.
https://github.com/elastic/kibana/issues/160897 outlines follow up work
to align how the CPU usage is presented in other places in the UI.

# Screenshots

**Above threshold:**
<img width="1331" alt="above-threshold"
src="4dc4dc2a-a858-4022-8407-8179ec3115df">

**Failed to compute usage:**
<img width="1324" alt="failed-to-compute"
src="88cb3794-6466-4881-acea-002a4f81c34e">

**Limits changed:**
<img width="2082" alt="limits-changed"
src="d0526421-9362-4695-ab00-af69aa9838c9">

**Limits missing:**
<img width="1743" alt="missing-resource-limits"
src="82626968-8b18-453d-9cf8-8a6776a6a46e">

**Unexpected limits:**
<img width="1637" alt="unexpected-resource-limits"
src="721deb15-d75b-4915-8f77-b18d0b33da7d">

# CPU usage for the Completely Fair Scheduler (CFS) for Control Groups
(cgroup)

The way CPU usage for containers is calculated is this formula:
`execution_time / (time_quota_per_schedule_period * number_of_periods)`

Execution time is a counter of how many cycles the container was allowed
to execute for by the scheduler, the quota is the limit of how many
cycles are allowed per period.

The number of periods is derived from the length of the period which can
also be changed. the default being 0.1 seconds.
At the end of each period, the available cycles is refilled to
`time_quota_per_schedule_period`. With a longer period, you're likely to
be throttled more often since you'll have to wait longer for a refresh,
so once you've used your allowance for that period you're blocked. With
a shorter period you're getting refilled more often so your total
available usage is higher.
Both scenarios have an effect on your percentage CPU usage but the
number of elapsed periods is a proxy for both of these cases. If you
wanted to know about throttling compared to only CPU usage then you
might want a separate rule for that stat. In short, 100% CPU usage means
you're being throttled to some degree. The number of periods is a safe
proxy for the details of period length as the period length will only
affect the rate at which quota is refreshed.

These fields are counters, so for any given time range, we need to grab
the biggest value (the latest) and subtract from that the lowest value
(the earliest) to get the delta, then we plug those delta values into
the formula above to get the factor (then multiply by 100 to make that a
percentage). The code also has some unit conversion because the quota is
in microseconds while the usage is in nano seconds.

# How to test

There are 3 main states to test:
No limit set but Kibana configured to use container stats.
Limit changed during lookback period (to/from real value, to/from no
limit).
Limit set and CPU usage crossing threshold and then falling down to
recovery

**Note: Please also test the non-container use case for this rule to
ensure that didn't get broken during this refactor**

**1. Start Elasticsearch in a container without setting the CPU
limits:**
```
docker network create elastic
docker run --name es01 --net elastic -p 9201:9200 -e xpack.license.self_generated.type=trial -it docker.elastic.co/elasticsearch/elasticsearch:master-SNAPSHOT
```

(We're using `master-SNAPSHOT` to include a recent fix to reporting for
cgroup v2)

Make note of the generated password for the `elastic` user.

**2. Start another Elasticsearch instance to act as the monitoring
cluster**

**3. Configure Kibana to connect to the monitoring cluster and start
it**

**4. Configure Metricbeat to collect metrics from the Docker cluster and
ship them to the monitoring cluster, then start it**

Execute the below command next to the Metricbeat binary to grab the CA
certificate from the Elasticsearch cluster.

```
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
```

Use the `elastic` password and the CA certificate to configure the
`elasticsearch` module:
```
  - module: elasticsearch
    xpack.enabled: true
    period: 10s
    hosts:
      - "https://localhost:9201"
    username: "elastic"
    password: "PASSWORD"
    ssl.certificate_authorities: "PATH_TO_CERT/http_ca.crt"
```

**5. Configure an alert in Kibana with a chosen threshold**

OBSERVE: Alert gets fired to inform you that there looks to be a
misconfiguration, together with reporting the current value for the
fallback metric (warning if the fallback metric is below threshold,
danger is if is above).

**6. Set limit**
First stop ES using `docker stop es01`, then set the limit using `docker
update --cpus=1 es01` and start it again using `docker start es01`.
After a brief delay you should now see the alert change to a warning
about the limits having changed during the alert lookback period and
stating that the CPU usage could not be confidently calculated.
Wait for change event to pass out of lookback window.

**7. Generate load on the monitored cluster**

[Slingshot](https://github.com/elastic/slingshot) is an option. After
you clone it, you need to update the `package.json` to match [this
change](8bfa8351de/package.json (L45-L46))
before running `npm install`.

Then you can modify the value for `elasticsearch` in the
`configs/hosts.json` file like this:
```
"elasticsearch": {
    "node": "https://localhost:9201",
    "auth": {
      "username": "elastic",
      "password": "PASSWORD"
    },
    "ssl": {
      "ca": "PATH_TO_CERT/http_ca.crt",
      "rejectUnauthorized": false
    }
  }
```

Then you can start one or more instances of Slingshot like this:
`npx ts-node bin/slingshot load --config configs/hosts.json`

**7. Observe the alert firing in the logs**
Assuming you're using a connector for server log output, you should see
a message like below once the threshold is breached:
```
`[2023-06-13T13:05:50.036+02:00][INFO ][plugins.actions.server-log] Server log: CPU usage alert is firing for node e76ce10526e2 in cluster: docker-cluster. [View node](/app/monitoring#/elasticsearch/nodes/OyDWTz1PS-aEwjqcPN2vNQ?_g=(cluster_uuid:kasJK8VyTG6xNZ2PFPAtYg))`
```

The alert should also be visible in the Stack Monitoring UI overview
page.

At this point you can stop Slingshot and confirm that the alert recovers
once CPU usage goes back down below the threshold.

**8. Stop the load and confirm that the rule recovers.**

# A second opinion

I made a little dashboard to replicate what the graph in SM and the rule
**_should_** see:

[cpu_usage_dashboard.ndjson.zip](11728315/cpu_usage_dashboard.ndjson.zip)

If you want to play with the data, I've collected an `es_archive` which
you can load like this:
`node scripts/es_archiver load PATH_TO_ARCHIVE/containerized_cpu_load
--es-url http://elastic:changeme@localhost:9200 --kibana-url
http://elastic:changeme@localhost:5601/__UNSAFE_bypassBasePath`

[containerized_cpu_load.zip](11754646/containerized_cpu_load.zip)

These are the timestamps to view the data:
Start: Jun 13, 2023 @ 11:40:00.000
End:   Jun 13, 2023 @ 12:40:00.000
CPU average: 52.76%

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-06 12:14:54 -07:00