Commit graph

32621 commits

Author SHA1 Message Date
Lene Gadewoll
2295ba10e0
Upgrade EUI to v95.4.0 (#188865)
`v95.3.0`  `v95.4.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.4.0`](https://github.com/elastic/eui/releases/v95.4.0)

- Added `anomalyChart`, `anomalySwimLane`, `changePointDetection`,
`fieldStatistics`, `logPatternAnalysis`, `logRateAnalysis` and
`singleMetricViewer` glyph to `EuiIcon`
([#7873](https://github.com/elastic/eui/pull/7873))

**Bug fixes**

- Fixed overlapping content in `EuiBasicTable` for expanded and
selectable table rows
([#7895](https://github.com/elastic/eui/pull/7895))
- Fixed the alignment of `EuiBasicTable` mobile actions
([#7895](https://github.com/elastic/eui/pull/7895))

**Accessibility**

- Improved `EuiStat`'s screen reader accessibility
([#7864](https://github.com/elastic/eui/pull/7864))

---

## Additional Changes

- reverts temporary fix for overlapping content in nested tables done in
PR [#188374](https://github.com/elastic/kibana/pull/188374)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-25 09:42:55 -07:00
Tiago Costa
579af1b5a6
skip flaky suite (#178457) 2024-07-25 17:35:59 +01:00
Maryam Saeidi
b17604dbbb
[Metric threshold] Save the ECS group by fields at the AAD root level (#188976)
Related to #183220

## Summary

This PR extracts `getEcsGroups` to a package to save ECS groups in the
Alert As Data (AAD) document for the metric threshold rule.

### 🧪 How to test
- Create a metric threshold rule with multiple groups (both ECS and
non-ECS fields)
- Check the related AAD document; you should be able to see the ECS
fields at the root level and not see non-ECS fields there
- Check the same information for the recovered alerts
- Rules without group by should work as before

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-25 10:20:12 -05:00
Juan Pablo Djeredjian
fb82b0e00d
[Security Solution] Extend the /upgrade/_review endpoint contract and functionality (#187770)
**Resolves: https://github.com/elastic/kibana/issues/180153**
**Resolves: https://github.com/elastic/kibana/issues/188277**

## Summary

- Extend the POST /upgrade/_review API endpoint's contract and
functionality
- Changes `has_conflict` property within each rule field's
`ThreeWayDiff` from `boolean` to `enum` with possible values:
    - `NONE`: no conflicts in three way diff
- `SOLVABLE`: conflict detected but was successfully resolved by our
algorithms
- `NON_SOLVABLE`: conflict detected and could not be resolved by our
algorithms.

- Adds `has_base_version` boolean field within each field diff
calculation. Has values:
- true: the base version of the field was found and is either defined or
undefined
    - false: the base version of the field was not found

- The possible values for `has_conflict` for each concrete diff
algorithm are:
    - **single line strings**: `NO`, `NON_SOLVABLE` 
    - **multi line strings**: `NO`, `SOLVABLE`, `NON_SOLVABLE` 
    - **numbers**: `NO`, `NON_SOLVABLE` 
    - **array of scalar values**: `NO`, `SOLVABLE`

- [ ] Adds new logic to handle
https://github.com/elastic/kibana/pull/186435#issuecomment-2178484224


### 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)
2024-07-25 17:08:15 +02:00
Tiago Costa
054ae81089
skip flaky suite (#174661) 2024-07-25 15:41:45 +01:00
Tiago Costa
f6c498cfae
skip flaky suite (#189004) 2024-07-25 15:40:35 +01:00
Julia Bardi
66401c6440
[Fleet] fix navigating back to Agent policy integration list (#189165)
## Summary

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

Fix navigating back from Agent policies and use Fleet url as a fallback
when no specific url is defined fro navigation.
To verify:
- Go to an Agent policy Integrations list
- Click on Edit integration action
- Cancel/Submit the form
- Verify that the page goes back to Agent policy Integrations list

<img width="1479" alt="image"
src="https://github.com/user-attachments/assets/daa6b0e2-0298-48fd-8c1c-c818d26a2585">
<img width="1476" alt="image"
src="https://github.com/user-attachments/assets/84a7a61e-9329-44ec-96c2-e6891f7627dc">
<img width="1475" alt="image"
src="https://github.com/user-attachments/assets/3504d934-6944-42b5-bb10-a212cd340784">



### 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
2024-07-25 16:36:58 +02:00
Thibault Richard
c5a00f6858
Typo fix for SLO burn rate rule edit page (#189110)
Correct typo from `serverity` to `severity` for SLO burn rate rule edit page.

---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-25 16:16:35 +02:00
jennypavlova
fd8b7f6177
[Infra] Change host count KPI query (#188950)
Closes #188757 

## Summary
 
This PR adds an endpoint to get the hosts (monitored by the system
integration) count. Currently, it supports only hosts but it can be
extended to other asset types (if/when needed). So the endpoint ( **POST
/api/infra/{assetType}/count** ) supports only 'host' as `{assetType}`.

⚠️ This PR adds only the endpoint - it is not used yet! To avoid having
different host counts and results shown on the UI this PR is not
updating the hook responsible for the request because currently the
hosts shown in the table are not filtered by the system integration
(showing the filtered result of this endpoint can lead to
inconsistencies between the count and the results shown in the table)
Once [#188756](https://github.com/elastic/kibana/issues/188756) and
[#188752](https://github.com/elastic/kibana/issues/188752) are done we
can use this endpoint.

## Testing

It can't be tested in the UI so we can test it:

<details>

<summary>Using curl:</summary> 

```bash

curl --location -u elastic:changeme 'http://0.0.0.0:5601/ftw/api/infra/host/count' \
--header 'kbn-xsrf: xxxx' \
--header 'Content-Type: application/json' \
--data '{
   "query": {
      "bool": {
         "must": [],
         "filter": [],
         "should": [],
         "must_not": []
      }
   },
   "from": "2024-07-23T11:34:11.640Z",
   "to": "2024-07-23T11:49:11.640Z",
   "sourceId": "default"
}'

```
</details>

In case of testing with oblt replace the `elastic:changeme` with your
user and password
2024-07-25 08:47:43 -05:00
Umberto Pepato
bd3032b5fa
[ResponseOps][Alerts] Migrate alerts fetching to TanStack Query (#186978)
## Summary

Implements a new `useSearchAlertsQuery` hook based on TanStack Query to
replace the `useFetchAlerts` hook, following [this organizational
logic](https://github.com/elastic/kibana/issues/186448#issuecomment-2228853337).

This PR focuses mainly on the fetching logic itself, leaving the
surrounding API surface mostly unchanged since it will be likely
addressed in subsequent PRs.

## To verify

1. Create rules that fire alerts in different solutions
2. Check that the alerts table usages work correctly ({O11y, Security,
Stack} alerts and rule details pages, ...)
1. Check that the alerts displayed in the table are coherent with the
solution, KQL query, time filter, pagination
    2. Check that pagination changes are reflected in the table
3. Check that changing the query when in pages > 0 resets the pagination
to the first page

Closes point 1 of https://github.com/elastic/kibana/issues/186448
Should fix https://github.com/elastic/kibana/issues/171738

### 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>
2024-07-25 08:36:56 -05:00
Kevin Lacabane
76237d8cf2
[eem] fix builtin definition metrics (#189065)
Closes https://github.com/elastic/kibana/issues/188769
Closes https://github.com/elastic/kibana/issues/188765

Fixes the throughput and failedTransactionRate that were not correctly
computed
2024-07-25 15:26:52 +02:00
Shahzad
67b8d98619
[Synthetics] Create SLO from Synthetics app for monitors !! (#188835)
## Summary
Fixes https://github.com/elastic/kibana/issues/178449
Create SLO from Synthetics app  for monitors !! 

<img width="1446" alt="image"
src="https://github.com/user-attachments/assets/c8224faf-cae3-4163-8a26-2c2db27e35f3">


https://github.com/user-attachments/assets/4eaf9777-e031-43cb-a41b-6aa67c41268c

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-25 15:24:14 +02:00
Julia Bardi
91d64f0481
[Fleet] document bundled packages config locally (#189175)
Document how to configure bundled packages in local setup.
2024-07-25 13:21:10 +00:00
Sander Philipse
a35d3178a8
[Search] Stop rerendering connector pages unnecessarily (#189103)
## Summary

This stops the connector tabs from incessantly re-rendering.
2024-07-25 14:29:02 +02:00
Sander Philipse
bfb24efe62
[Semantic Text] Fix semantic text when selecting multi-fields (#189118)
## Summary

This fixes a semantic text bug where selecting a multi-fields would
break the mappings. Instead we now filter out multi-fields from
reference fields, and recursively add any child fields to make sure we
don't break the denormalization anyway.


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### 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)
2024-07-25 14:28:41 +02:00
Maxim Palenov
efb2866d84
[Security Solution] Auto-bundle Timeline API OpenAPI specs (#188844)
**Addresses**: https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds scripts for automatic bundling of Timeline API OpenAPI
specs as a part of PR pipeline. Corresponding result bundles are
automatically committed to the Security Solution plugin
`x-pack/plugins/security_solution` in the `docs/openapi/ess/` and
`docs/openapi/serverless` folders (similar to
https://github.com/elastic/kibana/pull/186384).

---------

Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-25 14:26:25 +02:00
Marta Bondyra
eb1afcfb5d
[Lens] add error reason in workspace panel when error happens (#189161)
## Summary

Somewhere we stopped showing the error cause for workspace panel as
`longMessage` started being empty and the content for the error lives
principally in the `shortMessage`. This PR fixes it. Only two first
images come from actual environment, the other two errors are hardcoded
to check how it would look if only .longMessage is filled or both are.

<img width="651" alt="Screenshot 2024-07-25 at 11 13 17"
src="https://github.com/user-attachments/assets/2d8e1471-d95c-4f77-8fb5-5a68a05f7df0">
<img width="647" alt="Screenshot 2024-07-25 at 11 13 33"
src="https://github.com/user-attachments/assets/b37dc2ab-be83-4421-a8de-7c431f90687a">

<img width="644" alt="Screenshot 2024-07-25 at 11 17 05"
src="https://github.com/user-attachments/assets/576b0775-1a7f-4bdd-8e7c-96910fda4742">
only longMessage

<img width="654" alt="Screenshot 2024-07-25 at 11 13 03"
src="https://github.com/user-attachments/assets/4b680aed-97af-497c-be30-3bb356203190">
both
2024-07-25 14:20:58 +02:00
Nicolas Chaulet
ed74543cfd
[Fleet] Support secretRef as value for simplified package policies (#189070) 2024-07-25 08:01:40 -04:00
Katerina
ad403d2cbc
[APM] Fix log rate y axis format (#189054)
## Summary
closes https://github.com/elastic/kibana/issues/188247 
Before


![image](https://github.com/user-attachments/assets/d888bbe0-723c-48e8-a602-27619a465c41)

After 

![image](https://github.com/user-attachments/assets/4b8c5449-acd1-4ac3-9f80-5205e11c653e)
2024-07-25 13:54:44 +03:00
Sergi Massaneda
2bbedcc4c6
[Integration Assistant] Change ownership of integration autoImport (#188821)
## Summary

Changes the ownership of `x-pack/plugins/integration_assistant` plugin
to @elastic/security-scalability team
2024-07-25 05:49:08 -05:00
Vitalii Dmyterko
a8e19eef5d
[Security Solution][Detection Engine] removes feature flag for AI assistant on rule create form (#189040)
## Summary

- removes feature flag AIAssistantOnRuleCreationFormEnabled
2024-07-25 05:24:52 -05:00
Sander Philipse
fb34fc70bc
[Search] Fixes a bug where third-party models could not be saved (#189098)
## Summary

This enables saving a third-party model mappings in the UI with semantic
text.
2024-07-25 05:13:30 -05:00
Alexey Antonov
631baa336f
fix: [Obs Alert Rules > Rule Detail][KEYBOARD]: N Alerts and N Active Now elems must both be keyboard focsuable (#186529)
Closes: https://github.com/elastic/observability-dev/issues/3371

## Description

The Obs Alert Rule Detail view has a card that is clickable with a
focusable element inside it. This is a confusing paradigm and prevents
keyboard users from filtering by all alerts because it's not focusable.
It would be better to make the two alert number widgets the focusable
elements. Screenshot attached below.

PR is based on the following comment posted by @1Copenut in
https://github.com/elastic/observability-dev/issues/3371#issuecomment-2129446431_

> @alexwizp Agreed, panels should not be focusable. The highlighted
panel is clickable, and that was unexpected. I could click the entire
panel, and click the "1 Active now" text to filter by all alerts or
active alerts in the table below.
> 
> It would be better to have the "All alerts" text be clickable and
focusable, and keep the "1 Active now" clickable and focusable. That way
the two text blocks have the interactive behavior, while the panel
(card) is just a container.

### Steps to recreate

1. Open the [Obs
Alerts](https://keepserverless-qa-oblt-b4ba07.kb.eu-west-1.aws.qa.elastic.cloud/app/observability/alerts)
table
2. Click the "Manage Rules" link
3. Create a new rule and verify it appears in the Rules table
4. Click on the rule name to load the Rule Detail view
6. Verify the `1 Active Now`


### What was done?:
1. The click event was **REMOVED** from the panel and has been moved to
`All alerts.`
2. `aria-describedby` attributes were added for `AllAlertCounts` and
`ActiveAlertCounts`
3. `h3` attributes were replaced to `EuiTitle` in `AllAlertCounts` and
`ActiveAlertCounts`
2024-07-25 12:52:56 +03:00
Alexey Antonov
7b4e251bdb
fix: [Obs Alerts > Rule detail][SCREEN READER] Multiple single-item lists should be consolidated into one meaningful list: 0001 (#188293)
Closes: https://github.com/elastic/observability-dev/issues/3619

## Description
Observability has a number of description lists that are used to
identify important key-value pairs for users. Visually these look like a
single list of pairs, but they are coded as multiple single item lists.
This is potentially confusing to screen reader users because these data
points are related and should be in a single, consolidated list.

## What was changed?:

1. `RuleDefinition` has been updated to use `EuiDescriptionList`.
2. **The UI was affected.** In the main branch, the `Actions` item is
displayed in a separate column. With `EuiDescriptionList`, it's
displayed with other items.

## Screen: 

<img width="1274" alt="image"
src="https://github.com/user-attachments/assets/4634d44f-2c0b-423f-82a2-5aa04477e142">
2024-07-25 12:52:37 +03:00
Carlos Crespo
b99c392b5c
[Infra] Fix control filters loading (#189050)
fixes [189049](https://github.com/elastic/kibana/issues/189049)

## Summary

Fix a problem when loading the control filters when data view is still
loading


https://github.com/user-attachments/assets/f98dd4ae-72c6-4e19-9f25-99ff6a1e752c

### How to test
- Start a local Kibana instance
- Navigate to Infrastructure > Host
- Performa a full page refresh

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-25 11:09:24 +02:00
Jill Guyonnet
9e71c7e830
[Fleet] RBAC - Make agents write APIs space aware (#188507)
## Summary

Relates to https://github.com/elastic/kibana/issues/185040

This PR makes the following Fleet agents API space aware:
* `PUT /agents/{agentId}`
* `DELETE /agents/{agentId}`
* `POST /agents/bulk_update_agent_tags`

Actions created from `POST /agents/bulk_update_agent_tags` have the
`namespaces` property populated with the current space.

I am opening this PR with a few endpoints to get early feedback and make
this more agile. Other endpoints will be implemented in a followup PR.

### Testing

1. Enroll an agent in the default space.
2. Create a custom space and enroll an agent in it.
3. From the default space, test the `PUT /agents/{agentId}` and `DELETE
/agents/{agentId}` endpoints and check that the request fails for the
agent in the custom space.
4. Same test from the custom space.
5. From the default space, test the `POST
/agents/bulk_update_agent_tags` with all agents ids and check that only
the agents in the default space get updated.
6. Same test from the custom space.
7. Review the actions created from the bulk tag updates (the easiest way
is `GET .fleet-actions/_search`) and ensure the `namespaces` property is
correct.

### 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: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-25 09:36:35 +02:00
Dmitrii Shevchenko
b7e66ebf8a
[Fleet] Chunk asset installation during package install (#189045)
**Resolves: https://github.com/elastic/kibana/pull/189043**

## Summary

This PR limits the number of saved objects installed in a single
request. During saved object installation a lot of auxiliary objects are
created in memory. Chunking allows for the garbage collection of memory
objects that are not needed for response.

**Memory consumption before**

![Screenshot 2024-07-12 at 12 44
58](https://github.com/user-attachments/assets/2c7bb609-f107-46bd-bd98-43a0c58107e8)


**After**
![Screenshot 2024-07-18 at 11 53
30](https://github.com/user-attachments/assets/ff6529dd-033e-4c2b-9630-0a2ea3927c21)
2024-07-25 09:09:28 +02:00
Antonio
425d6b10a7
[ResponseOps][Rules] Version disable rule route (#188659)
## Summary

Parent Issue: #187572

Versions the `POST /rule/{id}/_disable` endpoint.

### 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
2024-07-25 09:06:04 +02:00
Jen Huang
2c08b0f290
[UII] Fix standalone agent policy download file name (#189147)
## Summary

Resolves #189048. This PR fixes the content type and file name for the
agent policy that is downloaded for standalone agents, following
https://github.com/elastic/kibana/pull/187133.

Also adjusts some copy casing.
2024-07-25 08:46:47 +02:00
Tiago Costa
da6f7b2003
skip flaky suite (#187720) 2024-07-25 03:46:17 +01:00
Tiago Costa
56ce68ea6b
skip flaky suite (#187854) 2024-07-25 03:44:59 +01:00
Tiago Costa
c3b0346a64
skip flaky suite (#178918) 2024-07-25 03:43:00 +01:00
Kibana Machine
f091389fc0 skip failing test suite (#189136) 2024-07-25 04:41:05 +02:00
Garrett Spong
f5459ba835
[Security Assistant] Fixes Knowledge Base setup when ML API's are unavailable or return an error (#189137)
## Summary

This PR resolves two issues: 

1. If ML API's are unavailable, we still show the 'Setup Knowledge Base'
button.
2. If an error occurs during KB setup, we don't show an error toast.


To test scenario `1.`, start Elasticsearch without ML, ala `yarn es
snapshot -E xpack.enabled.ml=false`, and observe the following disabled
'setup' buttons with tooltip directing users to the docs:

<p align="center">
<img width="200"
src="https://github.com/user-attachments/assets/cd4575fe-2d74-4e2c-8c6a-d5e458a00f6c"
/> <img width="200"
src="https://github.com/user-attachments/assets/b79a31d2-5d8d-42ed-9270-f646daa1402c"
/> <img width="200"
src="https://github.com/user-attachments/assets/a043c3b8-987a-4d07-afb8-b5f1ce6d7d6c"
/>
</p> 



To test scenario `2.`, start Elasticsearch with insufficient ML memory,
ala `yarn es snapshot -E xpack.ml.max_machine_memory_percent=5`, and
observe the following error toasts when setting up the KB:

<p align="center">
<img width="200"
src="https://github.com/user-attachments/assets/6ef592ce-b4dc-4bfb-a8ec-8e16b7557557"
/> <img width="200"
src="https://github.com/user-attachments/assets/9e5165a0-66a9-432d-9608-85b0680b3249"
/> <img width="200"
src="https://github.com/user-attachments/assets/e85d4c7c-80ba-4ea3-be4a-1addd3d2520f"
/>
</p> 


### 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)
- [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>
2024-07-24 17:47:51 -06:00
Maxim Palenov
cbb91f1f6b
[EDR Workflows] Auto-bundle Osquery API OpenAPI specs (#188920)
**Addresses**: https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds scripts for automatic bundling of Osquery API OpenAPI specs as a part of PR pipeline. Corresponding result bundles are automatically committed to the Osquery plugin `x-pack/plugins/osquery` in the `docs/openapi/ess` and `docs/openapi/serverless` folders (similar to https://github.com/elastic/kibana/pull/186384).
2024-07-24 18:02:39 -05:00
Steph Milovic
15554be700
[OpenAI Connector] Update default model to gpt-4o (#189080) 2024-07-24 17:59:15 -05:00
Maxim Palenov
d7f62b63d5
[Security Solution] Auto-bundle AI Assistant API OpenAPI specs (#188826)
**Addresses**: https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds scripts for automatic bundling of AI Assistant API OpenAPI specs as a part of PR pipeline. Corresponding result bundles are automatically committed to the Assistant Common package `x-pack/packages/kbn-elastic-assistant-common` in the `docs/openapi/ess/` and `docs/openapi/serverless` folders (similar to https://github.com/elastic/kibana/pull/186384).
2024-07-24 16:46:06 -04:00
Sandra G
20acef2391
Add knowledge team as codeowner (#189066)
The knowledge team is a codeowner of the other data access plugins and
should be on Logs.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 16:21:59 -04:00
Ying Mao
f1af9b4316
[Response Ops][Task Manager] Resource based task scheduling (#187999)
Resolves https://github.com/elastic/kibana/issues/185043

## Summary

### Task types can define a `cost` associated with running it

- Optional definition that defaults to `Normal` cost

### New `xpack.task_manager.capacity` setting

- Previous `xpack.task_manager.max_workers` setting is deprecated,
changed to optional, and a warning will be logged if used
- New optional `xpack.task_manager.capacity` setting is added. This
represents the number of normal cost tasks that can be run at one time.
- When `xpack.task_manager.max_workers` is defined and
`xpack.task_manager.capacity` is not defined, a deprecation warning is
logged and the value for max workers will be used as the capacity value.
- When `xpack.task_manager.capacity` is defined and
`xpack.task_manager.max_workers` is not defined, the capacity value will
be used. For the `default` claiming strategy, this capacity value will
be used as the `max_workers` value
- When both values are set, a warning will be logged and the value for
`xpack.task_manager.capacity` will be used
- When neither value is set, the `DEFAULT_CAPACITY` value will be used.

### Updates to `TaskPool` class

- Moves the logic to determine used and available capacity so that we
can switch between capacity calculators based on claim strategy. For the
`default` claim strategy, the capacity will be in units of workers. For
the `mget` claim strategy, the capacity will be in units of task cost.

### Updates to `mget` task claimer

- Updated `taskStore.fetch` call to take a new parameter that will
return a slimmer task document that excludes that task state and task
params. This will improve the I/O efficiency of returning up to 400 task
docs in one query
- Applies capacity constraint to the candidate tasks.
- Bulk gets the full task documents for the tasks we have capacity for
in order to update them to `claiming` status. Uses the
`SavedObjectsClient.bulkGet` which uses an `mget` under the hood.

### Updates the monitoring stats

- Emitting capacity config value and also capacity as translated into
workers and cost.
- Added total cost of running and overdue tasks to the health report

## Tasks for followup issues

- Update mget functional tests to include tasks with different costs. -
https://github.com/elastic/kibana/issues/189111
- Update cost of indicator match rule to be Extra Large -
https://github.com/elastic/kibana/issues/189112
- Set `xpack.task_manager.capacity` on ECH based on the node size -
https://github.com/elastic/kibana/pull/189117

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 16:00:11 -04:00
Luke G
f0c4cc367c
[Security Solution] Add retrieve results to timeline search strategy (#189031)
## Summary

This fixes missing `hits.hits` array and related errors.
2024-07-24 12:54:52 -05:00
Dominique Clarke
14f370b613
[Synthetics] allow retest on failure to be turned off (#189013)
## Summary

Resolves https://github.com/elastic/kibana/issues/188804

Allows retest on failure to be configured in the monitor creation UI.

https://www.loom.com/share/2302ccfd150b4668a61966be165478f8

### Testing
1. Create a monitor and toggle retest on failure off.
2. Navigate to edit that monitor. Ensure the setting remains off.

### Release note
Fixes a bug where retest on failure was not able to be turned off when
creating a monitor in the Synthetics app. Retest on failure can now be
turned off.
2024-07-24 13:45:39 -04:00
Kevin Delemme
e1e5d2893d
Change codeowners (#189093)
Change ownership of investigateapp to ux management
2024-07-24 12:06:37 -05:00
Tiago Costa
9585653468
skip flaky suite (#185046) 2024-07-24 18:02:44 +01:00
Tiago Costa
8c885e9c3f
skip flaky suite (#188450) 2024-07-24 18:00:37 +01:00
Bena Kansara
fabaf02e2f
[Custom threshold rule] Add last value aggregation (#187082)
Closes https://github.com/elastic/observability-dev/issues/3627

Adds last value aggregation in Custom threshold rule

<img width="608" alt="Screenshot 2024-07-02 at 11 45 59"
src="6b9a4fbf-565f-4485-9fd0-e419ce919401">
2024-07-24 18:47:56 +02:00
Nick Partridge
49a985625b
Upgrade prettier dependencies (#188032)
## Summary

- Upgrade `prettier` to `v2.8.x`.
- Upgrade related decencies.
- Adds `prettier` group to renovate config.
- Fixes bootstrapping type error.

## Main Changes

### Add parentheses for `TypeofTypeAnnotation` to improve readability

[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-for-typeoftypeannotation-to-improve-readability-14458-by-fisker)

```ts
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

### Add parentheses to head of `ExpressionStatement` instead of the
whole statement


[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-to-head-of-expressionstatement-instead-of-the-whole-statement-14077-by-fisker)

```ts
// Input
({}).toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);

// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo));

// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);
```

## Details

This started because I noticed we were on `typescript@^5` but still on
an old prettier that complained about use of new TS features such as
[`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 17:29:05 +01:00
Patryk Kopyciński
b4d1bc5dd7
Fix error toasters after license change (#188916)
## Summary

Fixes https://github.com/elastic/kibana/issues/188782

---------

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-24 18:20:51 +02:00
Paul Tavares
618e27c418
[Security Solution][Endpoint] Add logic to check and complete processes response action for SentinelOne (#188849)
## Summary

PR adds logic to background task to check and complete `processes`
response actions for SentinelOne. Changes include:

- Added logic, invoked by background task, to check and complete pending
`processes` response actions for SentinelOne
- UI: the Response console was adjusted for `processes` command to show
the download link to the file that contains the output of the
`processes` for sentinelone
- ℹ️ SentinelOne does not return the actual results for display, but
rather provides a `.zip` file that contains the output in `.csv` format
- Fixed a UI issue with the file download component where every time the
browser window was focus on, the component would show a loading
animation
- Updated the SentinelOne dev script so that the integration policy
created uses `30s` for the data pulling interval
2024-07-24 12:12:00 -04:00
Vitalii Dmyterko
4d5de12e9e
[Security Solution][Detection Engine] adds data tier filters to Kibana advanced settings (#186908)
## Summary

- addresses https://github.com/elastic/security-team/issues/9228
- introduces new Kibana advanced settings option
`securitySolution:excludedDataTiersForRuleExecution`, that allows to
exclude cold and frozen data tiers from search during rule execution
  - users would be able to add `data_cold` or/and `data_frozen` tiers
- **ES|QL** rule does not support this feature:
https://github.com/elastic/elasticsearch/issues/108264
- **Machine learning** rule does not support this feature
- Advanced setting available only for ESS

### UI

<img width="2300" alt="Screenshot 2024-07-04 at 17 31 34"
src="39beeda3-8030-4943-959c-53eb064fe5ae">


### Demo

1. Checking there are 3M+ documents in cold data tier of `test-frozen`
index
2. When rule executes, it generates alerts.
3. Checking kibana ancestor index of generated alert - it's
`restored-test-frozen-000001`, which confirms alert was created from a
document in cold tier
4. In advanced settings exlcude `data_cold` tier
5. Execute rule again, observe no alerts were created


c8b2f612-628a-452d-98e5-555c2e89d957

### How to test

Create a deployment with cold and frozen data tiers and use following
commands to create index and ILM

<details>
<summary>Data tiers commands</summary>

```JSON

PUT /_cluster/settings
{
  "persistent": {
    "indices.lifecycle.poll_interval": "1m"
  }
}


PUT /_ilm/policy/filtering_data_tiers
{
  "policy": {
    "phases": {
        "frozen": {
          "min_age": "10m",
          "actions": {
            "searchable_snapshot": {
              "snapshot_repository": "found-snapshots",
              "force_merge_index": true
            }
          }
        },
        "cold": {
          "min_age": "1m",
          "actions": {
            "searchable_snapshot": {
              "snapshot_repository": "found-snapshots",
              "force_merge_index": true
            },
            "set_priority": {
              "priority": 0
            }
          }
        },
        "hot": {
          "min_age": "0ms",
          "actions": {
            "set_priority": {
              "priority": 100
            }
          }
        }
    }
  }
}


PUT /_index_template/filtering_data_tiers_template
{
  "index_patterns": [
    "filtering_data_tiers*"
  ],
  "template": {
    "settings": {
      "index.lifecycle.name": "filtering_data_tiers",
      "index.lifecycle.rollover_alias": "test-filtering_data_tiers"
    },
    "mappings": {
      "_meta": {
        "version": "1.6.0"
      },
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "host": {
          "properties": {
            "name": {
              "type": "keyword",
              "ignore_above": 1024
            }
          }
        }
      }
    }
  }
}

PUT /filtering_data_tiers-000001
{
  "aliases": {
    "filtering_data_tiers": {
      "is_write_index": true
    }
  }
}


POST filtering_data_tiers/_doc
{
  "@timestamp": "2024-07-08T17:00:01.000Z",
  "host.name": "test-0"
}


```

</details>

**OR**
reach out to @vitaliidm to get access to already existing deployment/pR
deployment, where `test-frozen` index has cold and frozen nodes and ILM
policy that move any data to a tier according to config.

Check number of documents in tier by

```JSON
GET test-frozen/_count
{
    "query": {
     "bool": {
        "must": {
          "terms": {
            "_tier": ["data_cold"]
          }
        }
     }
   }
}
```

Create rule of supported type and query that index


### Checklist

- [x] Functional changes are covered with a test plan and automated
tests.
  - https://github.com/elastic/security-team/pull/9896

- [x] Comprehensive manual testing is done by two engineers: the PR
author and one of the PR reviewers. Changes are tested in both ESS and
Serverless.

- [x] Functional changes are communicated to the Docs team. A ticket or
PR is opened in https://github.com/elastic/security-docs. The following
information is included: any feature flags used, affected environments
(Serverless, ESS, or both).
  - https://github.com/elastic/security-docs/issues/5483
2024-07-24 11:09:20 -05:00
Janki Salvi
9422ef9977
[ResponseOps][Rules] OAS schema registration for Rule APIs (#188445)
## Summary

Issue:  https://github.com/elastic/kibana/issues/187574

This PR updates `request` and `response` schemas below for rule APIs to
generate OAS documentation:
- `POST /api/alerting/rule/{id?}`
- `GET /api/alerting/rule/{id}`
- `DELETE /api/alerting/rule/{id}`
- `PUT /api/alerting/rule/{id}`
- `GET /api/alerting/rules/_find`
- `POST /api/alerting/rule/{rule_id}/alert/{alert_id}/_mute`


### How to test

1. Start ES
2. Add `server.oas.enabled: true` to `kibana.dev.yml`
3. Start Kibana `yarn start --no-base-path`
4. `curl -s -uelastic:changeme
http://localhost:5601/api/oas\?pathStartsWith\=/api/alerting/rule/ | jq`
5. For find api run `curl -s -uelastic:changeme
http://localhost:5601/api/oas\?pathStartsWith\=/api/alerting/rules/ |
jq`
2024-07-24 17:06:21 +01:00