Commit graph

251 commits

Author SHA1 Message Date
Ying Mao
b219962bda
Revert "[ES body removal] @elastic/response-ops (#204882)" (#207899)
This reverts commit 7bb2dad38f.

Original PR https://github.com/elastic/kibana/pull/204882 caused errors
updating alert data stream index mappings in serverless. This seems to
be a difference in the Elasticsearch client code handling requests with
a body param vs requests without a body param
a4315a905e (diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439)
2025-01-22 22:47:06 -06:00
Alejandro Fernández Haro
7bb2dad38f
[ES body removal] @elastic/response-ops (#204882) 2025-01-21 14:10:54 +00:00
Artem Shelkovnikov
c88d519bff
Introduce Kibana task to deploy agentless connectors for 9.0 (#203973)
## Closes https://github.com/elastic/search-team/issues/8508
## Closes https://github.com/elastic/search-team/issues/8465

## Summary

This PR adds a background task for search_connectors plugin. This task
checks connector records and agentless package policies and sees if new
connector was added/old was deleted, and then adds/deletes package
policies for these connectors.

Scenario 1: a new connector was added by a user/API call

User creates an Elastic-managed connector:


https://github.com/user-attachments/assets/38296e48-b281-4b2b-9750-ab0a47334b55

When the user is done, a package policy is created by this background
task:


https://github.com/user-attachments/assets/12dbc33f-32bf-472d-b854-64588fc1e5b1

Scenario 2: a connector was deleted by a user/API call

User deletes an Elastic-managed connector:


https://github.com/user-attachments/assets/5997897e-fb9d-4199-8045-abe163264976

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jedr Blaszyk <jedrazb@gmail.com>
2025-01-10 11:22:00 +00:00
Paul Tavares
b1957ae209
[Stack Connectors][Microsoft Defender] Adds new connector for Microsoft Defender for Endpoint (#203183)
## Summary

- New connector for Microsoft Defender for Endpoint. To be used in
support of Security Solution Bi-Directional response actions.
2025-01-07 10:25:27 -05:00
Gerard Soldevila
49df29609e
Sustainable Kibana Architecture: Move modules owned by @elastic/response-ops (#202836)
## Summary

This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.

> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
>     * customised eslint rules
>     * docs pointing to source code

> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.

Are you trying to rebase this PR to solve merge conflicts? Please follow
the steps describe
[here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E).

#### 9 plugin(s) are going to be relocated:

| Id | Target folder |
| -- | ------------- |
| `@kbn/actions-plugin` | `x-pack/platform/plugins/shared/actions` |
| `@kbn/alerting-plugin` | `x-pack/platform/plugins/shared/alerting` |
| `@kbn/cases-plugin` | `x-pack/platform/plugins/shared/cases` |
| `@kbn/event-log-plugin` | `x-pack/platform/plugins/shared/event_log` |
| `@kbn/rule-registry-plugin` |
`x-pack/platform/plugins/shared/rule_registry` |
| `@kbn/stack-alerts-plugin` |
`x-pack/platform/plugins/shared/stack_alerts` |
| `@kbn/stack-connectors-plugin` |
`x-pack/platform/plugins/shared/stack_connectors` |
| `@kbn/task-manager-plugin` |
`x-pack/platform/plugins/shared/task_manager` |
| `@kbn/triggers-actions-ui-plugin` |
`x-pack/platform/plugins/shared/triggers_actions_ui` |




#### 12 packages(s) are going to be relocated:

| Id | Target folder |
| -- | ------------- |
| `@kbn/actions-types` |
`src/platform/packages/shared/kbn-actions-types` |
| `@kbn/alerting-comparators` |
`x-pack/platform/packages/shared/kbn-alerting-comparators` |
| `@kbn/alerting-state-types` |
`x-pack/platform/packages/private/kbn-alerting-state-types` |
| `@kbn/alerting-types` |
`src/platform/packages/shared/kbn-alerting-types` |
| `@kbn/alerts-as-data-utils` |
`src/platform/packages/shared/kbn-alerts-as-data-utils` |
| `@kbn/alerts-grouping` |
`x-pack/solutions/observability/packages/kbn-alerts-grouping` |
| `@kbn/alerts-ui-shared` |
`src/platform/packages/shared/kbn-alerts-ui-shared` |
| `@kbn/cases-components` |
`src/platform/packages/shared/kbn-cases-components` |
| `@kbn/grouping` | `src/platform/packages/shared/kbn-grouping` |
| `@kbn/response-ops-rule-params` |
`src/platform/packages/private/response-ops/rule_params` |
| `@kbn/rrule` | `src/platform/packages/shared/kbn-rrule` |
| `@kbn/triggers-actions-ui-types` |
`src/platform/packages/shared/kbn-triggers-actions-ui-types` |


<details open>
<summary>Script errors</summary>

```
Cannot replace multiple occurrences of "../../.." in the same line, please fix manually:	/Users/pgayvallet/DEV/workspaces/elastic/kibana/x-pack/platform/plugins/shared/alerting/README.md:257
Cannot replace multiple occurrences of "../../.." in the same line, please fix manually:	/Users/pgayvallet/DEV/workspaces/elastic/kibana/x-pack/platform/plugins/shared/stack_connectors/README.md:411
```

</details><details >
<summary>Updated relative paths</summary>

```
src/platform/packages/private/response-ops/rule_params/jest.config.js:12
src/platform/packages/private/response-ops/rule_params/tsconfig.json:2
src/platform/packages/private/response-ops/rule_params/tsconfig.type_check.json:2
src/platform/packages/private/response-ops/rule_params/tsconfig.type_check.json:20
src/platform/packages/shared/kbn-actions-types/jest.config.js:12
src/platform/packages/shared/kbn-actions-types/tsconfig.json:2
src/platform/packages/shared/kbn-actions-types/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-actions-types/tsconfig.type_check.json:22
src/platform/packages/shared/kbn-alerting-types/jest.config.js:12
src/platform/packages/shared/kbn-alerting-types/tsconfig.json:2
src/platform/packages/shared/kbn-alerting-types/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-alerting-types/tsconfig.type_check.json:25
src/platform/packages/shared/kbn-alerting-types/tsconfig.type_check.json:34
src/platform/packages/shared/kbn-alerting-types/tsconfig.type_check.json:40
src/platform/packages/shared/kbn-alerting-types/tsconfig.type_check.json:43
src/platform/packages/shared/kbn-alerts-as-data-utils/jest.config.js:12
src/platform/packages/shared/kbn-alerts-as-data-utils/tsconfig.json:2
src/platform/packages/shared/kbn-alerts-as-data-utils/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-alerts-ui-shared/jest.config.js:12
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.json:2
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:121
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:28
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:49
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:52
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:61
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:64
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:73
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:79
src/platform/packages/shared/kbn-alerts-ui-shared/tsconfig.type_check.json:82
src/platform/packages/shared/kbn-cases-components/jest.config.js:12
src/platform/packages/shared/kbn-cases-components/tsconfig.json:2
src/platform/packages/shared/kbn-cases-components/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-grouping/jest.config.js:12
src/platform/packages/shared/kbn-grouping/tsconfig.json:2
src/platform/packages/shared/kbn-grouping/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-grouping/tsconfig.type_check.json:24
src/platform/packages/shared/kbn-grouping/tsconfig.type_check.json:36
src/platform/packages/shared/kbn-rrule/jest.config.js:12
src/platform/packages/shared/kbn-rrule/tsconfig.json:2
src/platform/packages/shared/kbn-rrule/tsconfig.type_check.json:2
src/platform/packages/shared/kbn-triggers-actions-ui-types/jest.config.js:12
src/platform/packages/shared/kbn-triggers-actions-ui-types/tsconfig.json:2
src/platform/packages/shared/kbn-triggers-actions-ui-types/tsconfig.type_check.json:2
x-pack/platform/packages/private/kbn-alerting-state-types/jest.config.js:10
x-pack/platform/packages/private/kbn-alerting-state-types/tsconfig.json:2
x-pack/platform/packages/private/kbn-alerting-state-types/tsconfig.type_check.json:2
x-pack/platform/packages/private/kbn-alerting-state-types/tsconfig.type_check.json:20
x-pack/platform/packages/shared/kbn-alerting-comparators/jest.config.js:10
x-pack/platform/packages/shared/kbn-alerting-comparators/tsconfig.json:2
x-pack/platform/packages/shared/kbn-alerting-comparators/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/actions/docs/openapi/README.md:5
x-pack/platform/plugins/shared/actions/jest.config.js:10
x-pack/platform/plugins/shared/actions/jest.integration.config.js:10
x-pack/platform/plugins/shared/actions/server/integration_tests/axios_utils_connection.test.ts:35
x-pack/platform/plugins/shared/actions/server/integration_tests/axios_utils_proxy.test.ts:34
x-pack/platform/plugins/shared/actions/server/lib/custom_host_settings.test.ts:24
x-pack/platform/plugins/shared/actions/server/manual_tests/forward_proxy.js:46
x-pack/platform/plugins/shared/actions/server/sub_action_framework/README.md:358
x-pack/platform/plugins/shared/actions/tsconfig.json:2
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:100
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:103
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:106
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:112
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:115
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:118
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:121
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:124
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:19
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:46
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:49
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:52
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:55
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:58
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:61
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:64
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:67
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:70
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:73
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:76
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:79
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:82
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:85
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:88
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:91
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:94
x-pack/platform/plugins/shared/actions/tsconfig.type_check.json:97
x-pack/platform/plugins/shared/alerting/README.md:257
x-pack/platform/plugins/shared/alerting/README.md:274
x-pack/platform/plugins/shared/alerting/README.md:281
x-pack/platform/plugins/shared/alerting/jest.config.js:10
x-pack/platform/plugins/shared/alerting/jest.integration.config.js:10
x-pack/platform/plugins/shared/alerting/tsconfig.json:2
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:100
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:103
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:106
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:109
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:112
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:115
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:118
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:121
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:124
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:127
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:130
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:133
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:136
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:139
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:142
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:145
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:148
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:154
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:157
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:160
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:163
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:166
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:169
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:172
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:175
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:178
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:181
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:184
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:187
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:19
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:190
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:193
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:196
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:199
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:202
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:205
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:208
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:49
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:52
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:55
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:58
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:61
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:64
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:67
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:70
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:73
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:76
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:79
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:82
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:85
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:88
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:91
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:94
x-pack/platform/plugins/shared/alerting/tsconfig.type_check.json:97
x-pack/platform/plugins/shared/cases/jest.config.js:10
x-pack/platform/plugins/shared/cases/tsconfig.json:10
x-pack/platform/plugins/shared/cases/tsconfig.json:2
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:100
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:103
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:106
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:112
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:115
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:118
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:12
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:121
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:124
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:127
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:130
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:133
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:136
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:139
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:142
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:145
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:148
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:151
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:154
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:157
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:160
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:163
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:166
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:172
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:178
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:181
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:184
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:187
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:19
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:190
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:193
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:196
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:199
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:202
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:205
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:208
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:43
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:46
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:49
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:52
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:55
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:58
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:61
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:64
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:67
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:70
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:73
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:76
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:79
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:82
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:91
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:94
x-pack/platform/plugins/shared/cases/tsconfig.type_check.json:97
x-pack/platform/plugins/shared/event_log/README.md:330
x-pack/platform/plugins/shared/event_log/jest.config.js:10
x-pack/platform/plugins/shared/event_log/jest.integration.config.js:10
x-pack/platform/plugins/shared/event_log/scripts/create_schemas.js:257
x-pack/platform/plugins/shared/event_log/server/es/context.test.ts:14
x-pack/platform/plugins/shared/event_log/server/es/names.test.ts:10
x-pack/platform/plugins/shared/event_log/tsconfig.json:2
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:20
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:26
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:29
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:32
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:35
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:38
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:41
x-pack/platform/plugins/shared/event_log/tsconfig.type_check.json:47
x-pack/platform/plugins/shared/rule_registry/jest.config.js:10
x-pack/platform/plugins/shared/rule_registry/scripts/generate_ecs_fieldmap/index.js:19
x-pack/platform/plugins/shared/rule_registry/tsconfig.json:12
x-pack/platform/plugins/shared/rule_registry/tsconfig.json:2
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:13
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:20
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:23
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:32
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:35
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:38
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:41
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:44
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:50
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:53
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:56
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:59
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:62
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:65
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:68
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:71
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:74
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:77
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:80
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:83
x-pack/platform/plugins/shared/rule_registry/tsconfig.type_check.json:86
x-pack/platform/plugins/shared/stack_alerts/jest.config.js:10
x-pack/platform/plugins/shared/stack_alerts/server/rule_types/index_threshold/README.md:125
x-pack/platform/plugins/shared/stack_alerts/tsconfig.json:2
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:100
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:103
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:106
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:109
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:112
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:115
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:118
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:121
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:124
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:127
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:130
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:133
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:136
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:139
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:142
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:148
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:151
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:154
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:19
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:31
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:34
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:40
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:43
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:46
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:49
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:52
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:55
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:58
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:61
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:64
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:67
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:70
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:73
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:76
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:79
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:82
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:85
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:88
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:91
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:94
x-pack/platform/plugins/shared/stack_alerts/tsconfig.type_check.json:97
x-pack/platform/plugins/shared/stack_connectors/README.md:411
x-pack/platform/plugins/shared/stack_connectors/README.md:417
x-pack/platform/plugins/shared/stack_connectors/jest.config.js:10
x-pack/platform/plugins/shared/stack_connectors/tsconfig.json:2
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:101
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:107
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:110
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:113
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:20
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:29
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:32
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:35
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:38
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:41
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:44
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:50
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:53
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:56
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:59
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:62
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:65
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:68
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:71
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:74
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:77
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:80
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:83
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:89
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:92
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:95
x-pack/platform/plugins/shared/stack_connectors/tsconfig.type_check.json:98
x-pack/platform/plugins/shared/task_manager/README.md:64
x-pack/platform/plugins/shared/task_manager/jest.config.js:10
x-pack/platform/plugins/shared/task_manager/jest.integration.config.js:10
x-pack/platform/plugins/shared/task_manager/tsconfig.json:2
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:18
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:21
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:24
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:27
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:30
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:33
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:36
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:39
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:42
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:45
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:48
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:51
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:54
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:57
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:60
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:63
x-pack/platform/plugins/shared/task_manager/tsconfig.type_check.json:69
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1229
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1283
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1332
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1404
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1418
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1419
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1534
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1548
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1618
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:1632
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:312
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:335
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:336
x-pack/platform/plugins/shared/triggers_actions_ui/README.md:393
x-pack/platform/plugins/shared/triggers_actions_ui/jest.config.js:10
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.json:12
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.json:2
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:102
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:105
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:108
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:111
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:114
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:117
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:120
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:123
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:126
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:129
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:132
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:135
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:138
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:14
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:144
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:147
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:153
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:156
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:159
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:162
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:165
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:171
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:174
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:177
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:180
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:183
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:186
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:189
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:192
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:195
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:198
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:2
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:21
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:33
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:36
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:39
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:42
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:45
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:48
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:51
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:57
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:60
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:63
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:66
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:72
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:75
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:78
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:81
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:87
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:90
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:93
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:96
x-pack/platform/plugins/shared/triggers_actions_ui/tsconfig.type_check.json:99
x-pack/solutions/observability/packages/kbn-alerts-grouping/jest.config.js:12
x-pack/solutions/observability/packages/kbn-alerts-grouping/tsconfig.json:2
x-pack/solutions/observability/packages/kbn-alerts-grouping/tsconfig.type_check.json:2
x-pack/solutions/observability/packages/kbn-alerts-grouping/tsconfig.type_check.json:39
```

</details>

---------

Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-26 15:49:50 +01:00
Janki Salvi
279f4aec6f
[ResponseOps][Rules] Delete legacy routes (#203148)
## Summary

Resolves https://github.com/elastic/kibana/issues/195179
Resolves https://github.com/elastic/kibana/issues/192558

This PR deletes deprecated legacy alerts routes `api/alerts/alert` in
v9.0.
It also updates docs to reflect the same.


### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials



### Release notes
Deleted deprecated alerts routes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-16 08:35:28 -06:00
Jiawei Wu
5a9129e22d
[Response Ops] Remove ephemeral tasks from task manager plugin (#201313)
## Summary

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

Removes all reference to ephemeral tasks from the task manager plugin.
As well as unit and E2E tests while maintaining backwards compatibility
for `xpack.task_manager.ephemeral_tasks` flag to no-op if set. This PR
has some dependencies from the PR to remove ephemeral task support from
the alerting and actions plugin
(https://github.com/elastic/kibana/pull/197421). So it should be merged
after the other PR.

Deprecates the following configuration settings:

- xpack.task_manager.ephemeral_tasks.enabled
- xpack.task_manager.ephemeral_tasks.request_capacity

The user doesn't have to change anything on their end if they don't wish
to. This deprecation is made so if the above settings are defined,
kibana will simply do nothing.

### 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-12-13 14:31:31 -08:00
Sebastián Zaffarano
36b344a4c5
[Telemetry][Security Solution] Index metadata collector (#194004)
## Summary

Implements a security_solution task scheduled to run once a day to
collect the following information:

1. Datastreams stats
2. Indices stats
3. ILMs stats
4. ILM configs

The task allows a runtime configuration to limit the number of indices
and data streams to analyze or event to disable the feature entirely.

Once the data is gathered, the task sends it as EBT events.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-13 12:31:03 -06:00
Jiawei Wu
cdd1ba9b00
[Response Ops] Fix Task Manager Schedule Flaky Test (#201732)
## Summary

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

Fixes task manager schedule flaky test according to guidance posted
here: https://github.com/elastic/kibana/issues/161882

### 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-12-05 21:49:06 -06:00
Jiawei Wu
7f8812cf20
[Response Ops] Fix Task Manager Remove Types Flaky Test (#201728)
## Summary

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

Fixes flaky task manager remove types test by following the guidance
here: https://github.com/elastic/kibana/issues/161882

### 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-12-02 11:11:05 -08:00
Julia Bardi
973c69533b
[Fleet] flag package policy SO to trigger agent policy bump (#200536)
## Summary

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

Update:

Using a new SO field `bump_agent_policy_revision` in package policy type
to mark package policies for update, this will trigger an agent policy
revision bump.

The feature supports both legacy and new package policy SO types, and
queries policies from all spaces.

To test, add a model version change to the package policy type and save.
After Fleet setup is run, the agent policies using the package policies
should be bumped and deployed.
The same effect can be achieved by manually updating a package policy SO
and loading Fleet UI to trigger setup.
```
        '2': {
          changes: [
            {
              type: 'data_backfill',
              backfillFn: (doc) => {
                return { attributes: { ...doc.attributes, bump_agent_policy_revision: true } };
              },
            },
          ],
        },

  curl -sk -XPOST --user fleet_superuser:password -H 'content-type:application/json' \     -H'x-elastic-product-origin:fleet' \
     http://localhost:9200/.kibana_ingest/_update_by_query -d '
     { "query": {
      "match": {
        "type": "fleet-package-policies"
      }
    },"script": {
      "source": "ctx._source[\"fleet-package-policies\"].bump_agent_policy_revision = true",
      "lang": "painless"
    }
  }'

```

```
[2024-11-20T14:40:30.064+01:00][INFO ][plugins.fleet] Found 1 package policies that need agent policy revision bump
[2024-11-20T14:40:31.933+01:00][DEBUG][plugins.fleet] Updated 1 package policies in space space1 in 1869ms, bump 1 agent policies
[2024-11-20T14:40:35.056+01:00][DEBUG][plugins.fleet] Deploying 1 policies
[2024-11-20T14:40:35.493+01:00][DEBUG][plugins.fleet] Deploying policies: 7f108cf2-4cf0-4a11-8df4-fc69d00a3484:10
```

TODO:
- the same flag has to be added on agent policy and output types, and
the task extended to update them
  - I plan to do this in another pr, so that this doesn't become too big
- add integration test if possible

### Scale testing
Tested with 500 agent policies split to 2 spaces, 1 integration per
policy and bumping the flag in a new saved object model version, the
bump task took about 6s.
The deploy policies step is async, took about 30s.
```
[2024-11-20T15:53:55.628+01:00][INFO ][plugins.fleet] Found 501 package policies that need agent policy revision bump
[2024-11-20T15:53:57.881+01:00][DEBUG][plugins.fleet] Updated 250 package policies in space space1 in 2253ms, bump 250 agent policies
[2024-11-20T15:53:59.926+01:00][DEBUG][plugins.fleet] Updated 251 package policies in space default in 4298ms, bump 251 agent policies
[2024-11-20T15:54:01.186+01:00][DEBUG][plugins.fleet] Deploying 250 policies

[2024-11-20T15:54:29.989+01:00][DEBUG][plugins.fleet] Deploying policies: test-policy-space1-1:4, ...
[2024-11-20T15:54:33.538+01:00][DEBUG][plugins.fleet] Deploying policies: policy-elastic-agent-on-cloud:4, test-policy-default-1:4, ...

```

### 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-11-25 10:59:18 +01:00
Tiago Costa
613c702fb3
skip flaky suite (#200154) 2024-11-20 18:32:49 +00:00
Pierre Gayvallet
455c781c6d
[LLM tasks] Add product documentation retrieval task (#194379)
## Summary

Close https://github.com/elastic/kibana/issues/193473
Close https://github.com/elastic/kibana/issues/193474

This PR utilize the documentation packages that are build via the tool
introduced by https://github.com/elastic/kibana/pull/193847, allowing to
install them in Kibana and expose documentation retrieval as an LLM task
that AI assistants (or other consumers) can call.

Users can now decide to install the Elastic documentation from the
assistant's config screen, which will expose a new tool for the
assistant, `retrieve_documentation` (only implemented for the o11y
assistant in the current PR, shall be done for security as a follow up).

For more information, please refer to the self-review.

## General architecture

<img width="1118" alt="Screenshot 2024-10-17 at 09 22 32"
src="https://github.com/user-attachments/assets/3df8c30a-9ccc-49ab-92ce-c204b96d6fc4">

## What this PR does

Adds two plugin:
- `productDocBase`: contains all the logic related to product
documentation installation, status, and search. This is meant to be a
"low level" components only responsible for this specific part.
- `llmTasks`: an higher level plugin that will contain various LLM tasks
to be used by assistants and genAI consumers. The intent is not to have
a single place to put all llm tasks, but more to have a default place
where we can introduce new tasks from. (fwiw, the `nlToEsql` task will
probably be moved to that plugin).

- Add a `retrieve_documentation` tool registration for the o11y
assistant
- Add a component on the o11y assistant configuration page to install
the product doc

(wiring the feature to the o11y assistant was done for testing purposes
mostly, any addition / changes / enhancement should be done by the
owning team - either in this PR or as a follow-up)

## What is NOT included in this PR:

- Wire product base feature to the security assistant (should be done by
the owning team as a follow-up)
  - installation
  - utilization as tool

- FTR tests: this is somewhat blocked by the same things we need to
figure out for https://github.com/elastic/kibana-team/issues/1271

## Screenshots 

### Installation from o11y assistant configuration page

<img width="1476" alt="Screenshot 2024-10-17 at 09 41 24"
src="https://github.com/user-attachments/assets/31daa585-9fb2-400a-a2d1-5917a262367a">

### Example of output

#### Without product documentation installed 

<img width="739" alt="Screenshot 2024-10-10 at 09 59 41"
src="https://github.com/user-attachments/assets/993fb216-6c9a-433f-bf44-f6e383d20d9d">

#### With product documentation installed

<img width="718" alt="Screenshot 2024-10-10 at 09 55 38"
src="https://github.com/user-attachments/assets/805ea4ca-8bc9-4355-a434-0ba81f8228a9">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-11-19 08:28:26 -06:00
Søren Louv-Jansen
671ff30516
[AI Assistant] Use semantic_text for internal knowledge base (#186499)
Closes https://github.com/elastic/obs-ai-assistant-team/issues/162 
Closes https://github.com/elastic/kibana/issues/192757

This replaces the ML inference pipeline with `semantic_text` and adds a
migration task that runs automatically when Kibana starts.

Blocked by:
 - https://github.com/elastic/elasticsearch/pull/110027
 - https://github.com/elastic/elasticsearch/pull/110033
 - https://github.com/elastic/ml-team/issues/1298
2024-11-14 13:30:13 +01:00
Tiago Costa
9c5715744c
skip flaky suite (#198664) 2024-11-13 19:09:54 +00:00
Ying Mao
be949d66e4
[Response Ops][Task Manager] Adding background task to mark removed task types as unrecognized (#199057)
Resolves https://github.com/elastic/kibana/issues/192686

## Summary

Creates a background task to search for removed task types and mark them
as unrecognized. Removes the current logic that does this during the
task claim cycle for both task claim strategies.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-11 15:17:46 -05:00
Søren Louv-Jansen
7c92a10b32
[Obs AI Assistant] Add uuid to knowledge base entries to avoid overwriting accidentally (#191043)
Closes https://github.com/elastic/kibana/issues/184069

**The Problem**
The LLM decides the identifier (both `_id` and `doc_id`) for knowledge
base entries. The `_id` must be globally unique in Elasticsearch but the
LLM can easily pick the same id for different users thereby overwriting
one users learning with another users learning.

**Solution**
The LLM should not pick the `_id`. With this PR a UUID is generated for
new entries. This means the LLM will only be able to create new KB
entries - it will not be able to update existing ones.

`doc_id` has been removed, and replaced with a `title` property. Title
is simply a human readable string - it is not used to identify KB
entries.
To retain backwards compatability, we will display the `doc_id` if
`title` is not available

---------

Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-07 02:55:34 -06:00
Ersin Erdal
216f899621
Push the total request-body-bytes to usage-api (#194429)
Resolves: https://github.com/elastic/response-ops-team/issues/209 

This PR is a follow-on of https://github.com/elastic/kibana/pull/186804.

Creates a new task that runs every 1 hour to push the total
connector-request-body-bytes that have been saved in the event log to
usage-api.
2024-10-31 20:30:16 +01:00
Mike Côté
c31f11e7d8
Set mget task claim strategy as the default (#197070)
Resolves https://github.com/elastic/kibana/issues/194625

In this PR, I'm setting `mget` as the default task claiming strategy
along the following changes:
- Given we no longer need the 8.16 specific PRs
(https://github.com/elastic/kibana/pull/196317 and
https://github.com/elastic/kibana/pull/196757), I've also reverted them.
- Given we now use `met` as the default, I've renamed
`task_manager_claimer_mget` to `task_manager_claimer_update_by_query`
and made tests in that folder test using the `update_by_query` claim
strategy.
- Stabilize flaky tests caused by mget + polling for tasks more
frequently

Flaky test runners:
-
[[59b71bc](59b71bcdbe)]
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7197
-
[[aea910e](aea910e36d)]
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7199
-
[[4723ced](4723ced751)]
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7206
-
[[d28c8c5](d28c8c56f6)]
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7209
-
[[dd7773a](dd7773aeba)]
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7224

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-10-25 08:57:46 -04:00
Mike Côté
3b8cf1236b
Improve task manager functional tests in preperation for mget task claimer being the default (#196399)
Resolves https://github.com/elastic/kibana/issues/184942
Resolves https://github.com/elastic/kibana/issues/192023
Resolves https://github.com/elastic/kibana/issues/195573

In this PR, I'm improving the flakiness found in our functional tests in
preperation for mget being the default task claimer that all these tests
run with (https://github.com/elastic/kibana/issues/194625). Because the
mget task claimer works differently and also polls more frequently, we
end-up in situations where tasks run faster than they were with
update_by_query, creating more race conditions that are now fixed in
this PR.

Issues were surfaced via https://github.com/elastic/kibana/pull/190148
where I set `mget` as the default task claiming strategy.

Flaky test runs (some of these failed on other tests that are flaky):
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7151
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7169
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7172
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7175
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7176
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7185
(for
0fcf1ae689)
2024-10-21 08:02:59 -05:00
Jared Burgett
ea582dc650
Flipped Security Entity Store flag to being a "disable" flag (#195818)
## Summary

The Security Solution Entity Store feature will now be available by
default. However, there will be a flag that can be switched on, if
desired, to **disable** that feature entirely.

Regardless of whether this flag is enabled or not, Security's Entity
Store is still only fully enabled through an enablement workflow. In
other words, a Security Solution customer must turn on the feature
through an onboarding workflow in order to enable its features.

Additionally, we are disabling this feature in Serverless at first, to
perform proper Serverless load/performance testing. (We do not expect it
to be significantly different than ESS/ECH, but are doing so out of an
abundance of caution).

---------

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
2024-10-14 23:56:08 -05:00
Yuliia Naumenko
10622964ef
Disable Inference Connector experimental feature (#196036) 2024-10-14 15:21:35 -05:00
Julia Bardi
c53b2a8bb0
[Fleet] delete unenrolled agents task (#195544)
## Summary

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

Testing steps:
- enable deleting unenrolled agents by adding
`xpack.fleet.enableDeleteUnenrolledAgents: true` to `kibana.dev.yml` or
turn it on on the UI
- add some unenroll agents with the helper script
```
cd x-pack/plugins/fleet
node scripts/create_agents/index.js --status unenrolled --count 10

 info Creating 10 agents with statuses:
 info    unenrolled: 10
 info Batch complete, created 10 agent docs, took 0, errors: false
 info All batches complete. Created 10 agents in total. Goodbye!
```
- restart kibana or wait for the task to run and verify that the
unenrolled agents were deleted
```
[2024-10-08T16:14:45.152+02:00][DEBUG][plugins.fleet.fleet:delete-unenrolled-agents-task:0.0.5] [DeleteUnenrolledAgentsTask] Executed deletion of 10 unenrolled agents
[2024-10-08T16:14:45.153+02:00][INFO ][plugins.fleet.fleet:delete-unenrolled-agents-task:0.0.5] [DeleteUnenrolledAgentsTask] runTask ended: success
```

Added to UI settings:
<img width="1057" alt="image"
src="https://github.com/user-attachments/assets/2c9279f9-86a8-4630-a6cd-5aaa42e05fe7">

If the flag is preconfigured, disabled update on the UI with a tooltip:
<img width="1009" alt="image"
src="https://github.com/user-attachments/assets/45041020-6447-4295-995e-6848f0238f88">

The update is also prevented from the API:
<img width="2522" alt="image"
src="https://github.com/user-attachments/assets/cfbc8e21-e062-4e7f-9d08-9767fa387752">

Once the preconfiguration is removed, the UI update is allowed again.


### 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-10-14 11:04:01 +02:00
Yuliia Naumenko
288d41d61e
[Connectors][GenAI] Inference Service Kibana connector (#189027)
## Summary
Resolves https://github.com/elastic/kibana/issues/188043

This PR adds new connector which is define integration with Elastic
Inference Endpoint via [Inference
APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html)
The lifecycle of the Inference Endpoint are managed by the connector
registered handlers:

- `preSaveHook` -
[create](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html)
new Inference Endpoint in the connector create mode (`isEdit === false`)
and
[delete](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html)+[create](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html)
in the connector edit mode (`isEdit === true`)
- `postSaveHook` - check if the connector SO was created/updated and if
not removes Inference Endpoint from preSaveHook
- `postDeleteHook` -
[delete](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html)
Inference Endpoint if connector was deleted.

In the Kibana Stack Management Connectors, its represented with the new
card (Technical preview badge):

<img width="1261" alt="Screenshot 2024-09-27 at 2 11 12 PM"
src="https://github.com/user-attachments/assets/dcbcce1f-06e7-4d08-8b77-0ba4105354f8">

To simplify the future integration with AI Assistants, the Connector
consists from the two main UI parts: provider selector and required
provider settings, which will be always displayed
<img width="862" alt="Screenshot 2024-10-07 at 7 59 09 AM"
src="https://github.com/user-attachments/assets/87bae493-c642-479e-b28f-6150354608dd">

and Additional options, which contains optional provider settings and
Task Type configuration:

<img width="861" alt="Screenshot 2024-10-07 at 8 00 15 AM"
src="https://github.com/user-attachments/assets/2341c034-6198-4731-8ce7-e22e6c6fb20f">


subActions corresponds to the different taskTypes Inference API
supports. Each of the task type has its own Inference Perform params.
Currently added:

- completion & completionStream
- rerank
- text_embedding
- sparse_embedding

Follow up work:

1. Collapse/expand Additional options, when the connector flyout/modal
has AI Assistant as a context (path through the extending context
implementation on the connector framework level)
2. Add support for additional params for Completion subAction to be able
to path functions
3. Add support for tokens usage Dashboard, when inference API will
include the used tokens count in the response
4. Add functionality and UX for migration from existing specific AI
connectors to the Inference connector with proper provider and
completion task
5. Integrate Connector with the AI Assistants

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: István Zoltán Szabó <istvan.szabo@elastic.co>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
2024-10-13 15:39:09 -05:00
Pablo Machado
40eb9b279f
[SecuritySolution] Asset Criticality ECS compatibility (#194109)
## Summary
* New asset criticality ECS fields in mappings
* Schemas update
* Data client update
* Add check and throw an error if data migration is required
* Create a mappings and data migration
  * When kibana starts
    * Check if a mappings update is required
      * Update mappings
    * Check if data migration is required
      * Schedule a kibana task that runs the migration


New asset criticality fields: asset, host, user
Ts type definition:
https://github.com/elastic/kibana/pull/194109/files#diff-61d0a28910f5cc972f65e47ff8ba189a0b34bae0d7a0c492b88676d8059bc87dR88-R122


Blocked by: https://github.com/elastic/elasticsearch/pull/113588

### 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-10-02 08:36:44 -05:00
Mike Côté
d0d2032f18
Hook up discovery service to Task Manager health (#194113)
Resolves https://github.com/elastic/kibana/issues/192568

In this PR, I'm solving the issue where the task manager health API is
unable to determine how many Kibana nodes are running. I'm doing so by
leveraging the Kibana discovery service to get a count instead of
calculating it based on an aggregation on the `.kibana_task_manager`
index where we count the unique number of `ownerId`, which requires
tasks to be running and a sufficient distribution across the Kibana
nodes to determine the number properly.

Note: This will only work when mget is the task claim strategy

## To verify
1. Set `xpack.task_manager.claim_strategy: mget` in kibana.yml
2. Startup the PR locally with Elasticsearch and Kibana running
3. Navigate to the `/api/task_manager/_health` route and confirm
`observed_kibana_instances` is `1`
4. Apply the following code and restart Kibana
```
diff --git a/x-pack/plugins/task_manager/server/kibana_discovery_service/kibana_discovery_service.ts b/x-pack/plugins/task_manager/server/kibana_discovery_service/kibana_discovery_service.ts
index 090847032bf..69dfb6d1b36 100644
--- a/x-pack/plugins/task_manager/server/kibana_discovery_service/kibana_discovery_service.ts
+++ b/x-pack/plugins/task_manager/server/kibana_discovery_service/kibana_discovery_service.ts
@@ -59,6 +59,7 @@ export class KibanaDiscoveryService {
     const lastSeen = lastSeenDate.toISOString();
     try {
       await this.upsertCurrentNode({ id: this.currentNode, lastSeen });
+      await this.upsertCurrentNode({ id: `${this.currentNode}-2`, lastSeen });
       if (!this.started) {
         this.logger.info('Kibana Discovery Service has been started');
         this.started = true;
```
5. Navigate to the `/api/task_manager/_health` route and confirm
`observed_kibana_instances` is `2`

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-02 07:19:06 -04:00
Abdul Wahab Zahid
13736730d1
[Logs Data Telemetry] Create background job to collect and send logs data telemetry (#189380)
## Summary

The PR creates a service which runs in background as a Kibana Task and
lazily collects and processes logs data telemetry events. This
implementation collects the data by reading indices info and prepares
the telemetry events. These events will be reported to stack telemetry
in follow up PRs.

The service groups the stats per
[pattern_name](1116ac6daa/src/plugins/telemetry/server/telemetry_collection/get_data_telemetry/constants.ts (L42))
and gathers the following information:
- Docs and indices count (regular and failure)
- Count of unique namespaces found in data streams matching a pattern
- Size of the documents (regular only)
- Meta information (managed by, package name and if beat information is
found in mappings)
- Total fields count and count of individual log centric fields
- Count of docs corresponding to each structure level

The service gathers the data streams information and mapping and
generate events in the following manner:
```yml
[
  {
    "pattern_name": "heartbeat",
    "shipper": "heartbeat",
    "doc_count": 9239,
    "structure_level": {
      "5": 9239
    },
    "index_count": 1,
    "failure_store_doc_count": 9239,
    "failure_store_index_count": 1,
    "namespace_count": 0,
    "field_count": 1508,
    "field_existence": {
      "container.id": 9239,
      "log.level": 9239,
      "container.name": 9239,
      "host.name": 9239,
      "host.hostname": 9239,
      "kubernetes.pod.name": 9239,
      "kubernetes.pod.uid": 9239,
      "cloud.provider": 9239,
      "agent.type": 9239,
      "event.dataset": 9239,
      "event.category": 9239,
      "event.module": 9239,
      "service.name": 9239,
      "service.type": 9239,
      "service.version": 9239,
      "message": 9239,
      "event.original": 9239,
      "error.message": 9239,
      "@timestamp": 9239,
      "data_stream.dataset": 9239,
      "data_stream.namespace": 9239,
      "data_stream.type": 9239
    },
    "size_in_bytes": 12382655,
    "managed_by": [],
    "package_name": [],
    "beat": [
      "heartbeat"
    ]
  },
  {
    "pattern_name": "nginx",
    "doc_count": 10080,
    "structure_level": {
      "6": 10080
    },
    "index_count": 1,
    "failure_store_doc_count": 0,
    "failure_store_index_count": 0,
    "namespace_count": 1,
    "field_count": 1562,
    "field_existence": {
      "container.id": 10080,
      "log.level": 10080,
      "host.name": 10080,
      "kubernetes.pod.uid": 10080,
      "cloud.provider": 10080,
      "event.dataset": 10080,
      "service.name": 10080,
      "message": 10080,
      "@timestamp": 10080,
      "data_stream.dataset": 10080,
      "data_stream.namespace": 10080,
      "data_stream.type": 10080
    },
    "size_in_bytes": 12098071,
    "managed_by": [],
    "package_name": [],
    "beat": []
  },
  {
    "pattern_name": "apache",
    "doc_count": 1439,
    "structure_level": {
      "6": 1439
    },
    "index_count": 1,
    "failure_store_doc_count": 0,
    "failure_store_index_count": 0,
    "namespace_count": 2,
    "field_count": 1562,
    "field_existence": {
      "container.id": 1439,
      "log.level": 1439,
      "host.name": 1439,
      "kubernetes.pod.uid": 1439,
      "cloud.provider": 1439,
      "event.dataset": 1439,
      "service.name": 1439,
      "message": 1439,
      "@timestamp": 1439,
      "data_stream.dataset": 1439,
      "data_stream.namespace": 1439,
      "data_stream.type": 1439
    },
    "size_in_bytes": 4425502,
    "managed_by": [],
    "package_name": [],
    "beat": []
  },
  {
    "pattern_name": "generic-logs",
    "doc_count": 106659,
    "structure_level": {
      "2": 100907,
      "3": 5752
    },
    "index_count": 6,
    "failure_store_doc_count": 0,
    "failure_store_index_count": 0,
    "namespace_count": 2,
    "field_count": 1581,
    "field_existence": {
      "log.level": 106659,
      "host.name": 106659,
      "service.name": 106659,
      "@timestamp": 106659,
      "data_stream.dataset": 106659,
      "data_stream.namespace": 106659,
      "data_stream.type": 106659,
      "container.id": 5752,
      "kubernetes.pod.uid": 5752,
      "cloud.provider": 5752,
      "event.dataset": 5752,
      "message": 5752
    },
    "size_in_bytes": 29752097,
    "managed_by": [],
    "package_name": [],
    "beat": []
  }
]
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-17 21:58:34 +07:00
Nicolas Chaulet
ea57fb09c0
[Fleet] Introduce Async deploy policies (#191839) 2024-09-09 09:45:12 -04:00
Dzmitry Lemechko
8436f45fd1
FTR: enable ESLint mocha rules for api integration tests (#191267)
## Summary

Follow-up to #190690

Most of API integration tests does not match the path pattern set in the
original PR (thanks @pheyos for catching it) and where not updated.
This PR updates `.eslintrc.js` with explicit patterns to lint
api_integration tests. Hopefully it is final change, but I rely on code
owners to double check it.

Most of the changes are trivial adjustments:
- duplicated before/after hooks `mocha/no-sibling-hooks`
- duplicated test titles `mocha/no-identical-title`
- async function in describe() `mocha/no-async-describe`

---------

Co-authored-by: Ash <1849116+ashokaditya@users.noreply.github.com>
2024-08-30 18:50:35 +02:00
Nicolas Chaulet
fe0d310b15
[Fleet] Upgrade managed package policies in a background task (#191097) 2024-08-29 08:09:22 -04:00
Dzmitry Lemechko
fa69337c94
[FTR] enable recommended mocha + no-floating-promises ESLint rules (#190690)
## Summary

This PR enforces ESLint rules in FTR tests, in particular:
- `no-floating-promises` rule to catch unawaited Promises in
tests/services/page objects

_Why is it important?_
- Keep correct test execution order: cleanup code may run before the
async operation is completed, leading to unexpected behavior in
subsequent tests
- Accurate test results: If a test completes before an async operation
(e.g., API request) has finished, Mocha might report the test as passed
or failed based on incomplete context.
```
198:11  error  Promises must be awaited, end with a call to .catch, end with a call to .then
with a rejection handler or be explicitly marked as ignored with the `void` operator 
@typescript-eslint/no-floating-promises
```
<img width="716" alt="Screenshot 2024-08-20 at 14 04 43"
src="https://github.com/user-attachments/assets/9afffe4c-4b51-4790-964c-c44a76baed1e">

- recommended rules from
[eslint-mocha-plugin](https://www.npmjs.com/package/eslint-plugin-mocha)
including:
-
[no-async-describe](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-async-describe.md)
-
[no-identical-title.md](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-identical-title.md)
-
[no-sibling-hooks.md](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-sibling-hooks.md)
and others

Note for reviewers: some tests were skipped due to failures after
missing `await` was added. Most likely is a "false positive" case when
test is finished before async operation is actually completed. Please
work on fixing and re-enabling it

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-23 11:54:36 -05:00
Mike Côté
fdae1348df
Rename task claimers (#190542)
In this PR, I'm renaming the task managers as we prepare to rollout the
`mget` task claiming strategy as the default.

Rename:
- `unsafe_mget` -> `mget`
- `default` -> `update_by_query`

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-21 11:09:10 -04:00
Cristina Amico
15657536ed
[Fleet] Create task that periodically unenrolls inactive agents (#189861)
Closes https://github.com/elastic/kibana/issues/179399

## Summary

Create a new periodic task that unenrolls inactive agents based on
`unenroll_timeout` set on agent policies

In the agent policy settings there is now a new section:

![Screenshot 2024-08-06 at 12 31
37](https://github.com/user-attachments/assets/f66164c5-3eff-442d-91bc-367387cefe3d)



### Testing
- Create a policy with `unenroll_timeout` set to any value
- Enroll many agents to a policy and make them inactive - you can use
Horde or the script in `fleet/scripts/create_agents' that can directly
create inactive agents
- Leave the local env running for at least 10 minutes
- You should see logs that indicate that the task ran successfully and
remove the inactive agents
![Screenshot 2024-08-06 at 12 14
13](https://github.com/user-attachments/assets/573f32fb-eedb-4bee-918c-f26fedec9e0b)
Note that the executed unenroll action is also visible in the UI:
![Screenshot 2024-08-06 at 12 19
52](https://github.com/user-attachments/assets/942932ac-70dd-4d77-bf47-20007ac54748)
- If there are no agent policies with `unenroll_timeout` set or there
are no inactive agents on those policies, you should see logs like
these:
![Screenshot 2024-08-06 at 12 13
49](https://github.com/user-attachments/assets/8868c228-fd09-4ecf-ad02-e07a94812638)





### 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: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-19 08:09:47 -05:00
Ying Mao
e46e54a18c
[Response Ops][Task Manager] Resource based task scheduling - 2nd attempt (#189626)
## Summary

Redoing the resource based task claim PR:
https://github.com/elastic/kibana/pull/187999 and followup PRs
https://github.com/elastic/kibana/pull/189220 and
https://github.com/elastic/kibana/pull/189117. Please see the
descriptions of those PRs for more details.

This was original reverted because unregistered task types in serverless
caused the task manager health aggregation to fail. This PR includes an
additional commit to exclude unregistered task types from the health
report:
58eb2b1db7.

To verify this, make sure you're using the `default` claim strategy,
start up Kibana so that the default set of tasks get created. Then
either disable a bunch of plugins via config:

```
# remove security and o11y
enterpriseSearch.enabled: false
xpack.apm.enabled: false
xpack.cloudSecurityPosture.enabled: false
xpack.fleet.enabled: false
xpack.infra.enabled: false
xpack.observability.enabled: false
xpack.observabilityAIAssistant.enabled: false
xpack.observabilityLogsExplorer.enabled: false
xpack.search.notebooks.enabled: false
xpack.securitySolution.enabled: false
xpack.uptime.enabled: false
```

or comment out the task registration of a task that was previously
scheduled (I'm using the observability AI assistant)

```
--- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/index.ts
+++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/index.ts
@@ -89,24 +89,24 @@ export class ObservabilityAIAssistantService {

     this.allowInit();

-    taskManager.registerTaskDefinitions({
-      [INDEX_QUEUED_DOCUMENTS_TASK_TYPE]: {
-        title: 'Index queued KB articles',
-        description:
-          'Indexes previously registered entries into the knowledge base when it is ready',
-        timeout: '30m',
-        maxAttempts: 2,
-        createTaskRunner: (context) => {
-          return {
-            run: async () => {
-              if (this.kbService) {
-                await this.kbService.processQueue();
-              }
-            },
-          };
-        },
-      },
-    });
+    // taskManager.registerTaskDefinitions({
+    //   [INDEX_QUEUED_DOCUMENTS_TASK_TYPE]: {
+    //     title: 'Index queued KB articles',
+    //     description:
+    //       'Indexes previously registered entries into the knowledge base when it is ready',
+    //     timeout: '30m',
+    //     maxAttempts: 2,
+    //     createTaskRunner: (context) => {
+    //       return {
+    //         run: async () => {
+    //           if (this.kbService) {
+    //             await this.kbService.processQueue();
+    //           }
+    //         },
+    //       };
+    //     },
+    //   },
+    // });
   }
```

and restart Kibana. You should still be able to access the TM health
report with the workload field and if you update the background health
logging so it always logs and more frequently, you should see the
logging succeed with no errors:

Below, I've made changes to always log the background health at a 15
second interval:

```
--- a/x-pack/plugins/task_manager/server/plugin.ts
+++ b/x-pack/plugins/task_manager/server/plugin.ts
@@ -236,6 +236,7 @@ export class TaskManagerPlugin
     if (this.isNodeBackgroundTasksOnly()) {
       setupIntervalLogging(monitoredHealth$, this.logger, LogHealthForBackgroundTasksOnlyMinutes);
     }
+    setupIntervalLogging(monitoredHealth$, this.logger, LogHealthForBackgroundTasksOnlyMinutes);
reduce the logging interval


--- a/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts
+++ b/x-pack/plugins/task_manager/server/lib/log_health_metrics.ts
@@ -35,7 +35,8 @@ export function setupIntervalLogging(
     monitoredHealth = m;
   });

-  setInterval(onInterval, 1000 * 60 * minutes);
+  // setInterval(onInterval, 1000 * 60 * minutes);
+  setInterval(onInterval, 1000 * 15);

   function onInterval() {
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-07 15:27:52 -04:00
Ying Mao
7b38be0766
[main] Revert TM resource based task scheduling issues (#189529) (#189554)
# Backport

This will backport the following commits from `deploy-fix@1722233551` to
`main`:
- [Revert TM resource based task scheduling issues
(#189529)](https://github.com/elastic/kibana/pull/189529)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2024-07-30T16:53:27Z","message":"Revert
TM resource based task scheduling issues
(#189529)","sha":"32459096ff32fa4523fea5f17e1ff9aa881dbef7","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[],"number":189529,"url":"https://github.com/elastic/kibana/pull/189529","mergeCommit":{"message":"Revert
TM resource based task scheduling issues
(#189529)","sha":"32459096ff32fa4523fea5f17e1ff9aa881dbef7"}},"sourceBranch":"deploy-fix@1722233551","suggestedTargetBranches":[],"targetPullRequestStates":[]}]
BACKPORT-->
2024-07-30 20:11:01 -04:00
Brijesh Khunt
696190db60
TheHive Case Connector (#180138)
## Summary

TheHive is a new case connector, enabling users to seamlessly transfer
elastic cases to TheHive Security Incident Response Platform. This
connector facilitates sub-actions such as creating cases, updating
cases, and adding comments and creating alerts.

**create connector**

![thehive-connector](1e9a3fc5-c17a-40b5-8a49-87cd0fd74863)

**test connector**
1. **create case**


![thehive-params-case-test](2652ea5e-8b47-42d9-9b11-c055efe291b3)

2. **create alert**


![thehive-params-alert-test](8c8759c0-609c-4e34-bc21-35d648e684ab)


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

### 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Janki Salvi <jankigaurav.salvi@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-30 11:36:21 +03: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
Ersin Erdal
0a6b6071cd
Kibana discovery service (#187997)
Resolves: #187696

This PR introduces Kibana Discovery Service for the TaskManager plugin.

- Creates a new SO type in the TaskManagerIndex.
- The SO has 2 fields: `id` (holds the kibana node id) and `last_seen`
(timestamp of the last update applied by the node)
- Discovery Service in TM creates an SO on start and updates its
last_seen field every 10s
- The service also deletes the SOs that haven't been updated in the last
5m, by checking the index every 1m.
- TM deletes its SO on plugin stop.
- Discovery Service provides an API (`getActiveKibanaNodes`) to get the
active kibana nodes (last_seen field has been updated in the last 30s)

## To verify:
Run your Kibana locally and check the `.kibana_task_manager` index with
the below query, there should be an SO and its last_seen field should be
updated every 10s.

```
{
    "query": {
      "term": {
        "type": "background-task-node"        
      }
    },
    "size" : 10
}
```
---

The PR has been deployed to cloud as well, you can check the SOs for
multiple Kibana instances there.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-17 19:29:55 +02:00
Ying Mao
83c151278e
[Response Ops][Task Manager] Provide a way for recurring tasks to indicate that they should be deleted. (#184776)
Resolves https://github.com/elastic/kibana/issues/181145

## Summary

Adds an optional flag `shouldDeleteTask` to a successful task run
result. If this flag is set to true, task manager will remove the task
at the end of the processing cycle. This allows tasks to gracefully
inform us that they need to be deleted without throwing an unrecoverable
error (the current way that tasks tell us they want to be deleted).

Audited existing usages of `throwUnrecoverableError`. Other than usages
within the alerting and actions task runner, which are thrown for valid
error states, all other usages were by tasks that were considered
outdated and should be deleted. Updated all those usages to return the
`shouldDeleteTask` run result.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-12 16:21:52 -04:00
honeyn303
1ff87eb551
Gemini connector integration (#183668) 2024-06-06 11:52:35 -06:00
Ying Mao
74d1430305
Revert "[Response Ops][Task Manager] Emitting metrics when metrics are reset (#184846)
## Summary

Reverted
557633456c
from deploy@1717401777 as part of emergency release. This PR is
following the emergency release guidelines to:

`In a separate PR, the fix should be "frontported" to main by manually
cherry-picking the commit.`
2024-06-05 13:40:00 -04:00
Ying Mao
557633456c
[Response Ops][Task Manager] Emitting metrics when metrics are reset (#184592)
## Summary

This updates the task manager metrics aggregator to collect and emit
metrics when a `reset$` event is observed.

The `/api/task_manager/metrics` route subscribes to and saves the latest
task manager metrics and immediately returns the latest metrics when the
API is accessed. At a minimum, metrics are collected and emitted at
every polling interval (every 3 seconds). Usually emission is more
frequent than this because we emit metrics events every time a task run
completes.

Under normal circumstances, when the agent is configured to collect from
the API once every 10 seconds, this is what happens

```
00:00:00 metrics$.subscribe(({errors: 3}) => lastMetrics = metrics) - metrics emitted and saved
00:00:03 metrics$.subscribe(({errors: 4}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05 API called with reset=true, return lastMetrics, metrics reset to 0
00:00:06 metrics$.subscribe(({errors: 1}) => lastMetrics = metrics) - metrics emitted and saved
00:00:09 metrics$.subscribe(({errors: 2}) => lastMetrics = metrics) - metrics emitted and saved
00:00:10 API called with reset=true, return lastMetrics, metrics reset to 0
```

We can see that the metrics are reset and then by the time the next
collection interval comes around, fresh metrics have been emitted.

We currently have an issue where the API is collected against twice in
quick succession. Most of the time, this leads to duplicate metrics
being collected.

```
00:00:00:00 metrics$.subscribe(({errors: 3}) => lastMetrics = metrics) - metrics emitted and saved
00:00:03:00 metrics$.subscribe(({errors: 4}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05:00 API called with reset=true, return lastMetrics, metrics reset to 0 
00:00:05:01 API called with reset=true, return lastMetrics, metrics reset to 0 - this is a duplicate
00:00:06:00 metrics$.subscribe(({errors: 1}) => lastMetrics = metrics) - metrics emitted and saved
00:00:09:00 metrics$.subscribe(({errors: 2}) => lastMetrics = metrics) - metrics emitted and saved
```

However sometimes, this leads to a race condition that leads to
different metrics being collected.

```
00:00:00:00 metrics$.subscribe(({errors: 3}) => lastMetrics = metrics) - metrics emitted and saved
00:00:03:00 metrics$.subscribe(({errors: 4}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05:00 API called with reset=true, return lastMetrics, metrics reset to 0
00:00:05:01 metrics$.subscribe(({errors: 1}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05:02 API called with reset=true, return lastMetrics, metrics reset to 0
00:00:06:00 metrics$.subscribe(({errors: 1}) => lastMetrics = metrics) - metrics emitted and saved
00:00:09:00 metrics$.subscribe(({errors: 2}) => lastMetrics = metrics) - metrics emitted and saved
```

With this PR, on every reset, we'll re-emit the metrics so so even in
the face of the duplicate collection, we won't be emitting duplicate
metrics. After this is deployed, we should not need to exclude
`kubernetes.container.name :"elastic-internal-init-config"` from the
dashboards

```
00:00:00:00 metrics$.subscribe(({errors: 3}) => lastMetrics = metrics) - metrics emitted and saved
00:00:03:00 metrics$.subscribe(({errors: 4}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05:00 API called with reset=true, return lastMetrics, metrics reset to 0 
00:00:05:00 metrics$.subscribe(({errors: 0}) => lastMetrics = metrics) - metrics emitted and saved
00:00:05:01 API called with reset=true, return lastMetrics, metrics reset to 0
00:00:05:01 metrics$.subscribe(({errors: 0}) => lastMetrics = metrics) - metrics emitted and saved
00:00:06:00 metrics$.subscribe(({errors: 1}) => lastMetrics = metrics) - metrics emitted and saved
00:00:09:00 metrics$.subscribe(({errors: 2}) => lastMetrics = metrics) - metrics emitted and saved
```
2024-05-31 14:05:09 -04:00
Paul Tavares
4b2afc8461
[Security Solution][Endpoint] Enable responseActionsSentinelOneV2Enabled feature flag in main (#183664)
## Summary

- Enables the `responseActionsSentinelOneV2Enabled` feature flag for
`main`
- This same FF was enabled already in 8.14 via:
https://github.com/elastic/kibana/pull/182384
- Changes the background task for completing response actions to have an
initial timeout of `5m` (instead of `20m`)
2024-05-21 15:59:51 -04:00
Ying Mao
ee1552f10d
[Response Ops][Alerting] Backfill Rule Runs (#177622)
This is the feature branch that contains the following commits. Each
individual PR contains a summary and verification instructions.

- [Schedule backfill API](https://github.com/elastic/kibana/pull/176185)
- [Backfill task runner](https://github.com/elastic/kibana/pull/177640)
- [Get/Find/Delete backfill
API](https://github.com/elastic/kibana/pull/179975)
- [API key invalidation
update](https://github.com/elastic/kibana/pull/180749)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-25 15:36:01 -04:00
Tomasz Ciecierski
b66be1f69b
[EDR Workflows] Add Crowdstrike connector and Actions (#180175) 2024-04-17 11:51:19 -07:00
Kevin Lacabane
66587d8940
[Obs AI Assistant] ai assistant system connector (#179980)
## Summary

Creates a system connector that can call the observability ai assistant
to execute actions on behalf of user. The connector is tagged as tech
preview.

The connector can be triggered when an alert fires. Connector can be
configured with an initial message to the assistant which generates an
answer and triggers potential actions on the assistant side. The current
experimental scenario is to ask the assistant to generate a report of
the alert that fired (by initially providing some context in the first
message), recalling any information/potential resolutions of previous
occurrences stored in the knowledge base and also including other active
alerts that may be related. One last step that can be asked to the
assistant is to trigger an action, currently only sending the report (or
any other message) to a preconfigured slack webhook is supported.

## Testing
_Note: when asked to send a message to another connector (in our case
slack), we'll try to include a link to the generated conversation. It is
only possible to generate this link if
[server.publicBaseUrl](https://www.elastic.co/guide/en/kibana/current/settings.html#server-publicBaseUrl)
is correctly set in kibana settings._

- Create a slack webhook connector
- Get slack webhook. I can share one and invite you to the workspace, or
if you want to create one:
    - create personal workspace at https://slack.com/signin#workspaces
    - create an app for that workspace at https://api.slack.com/apps
- under Features > OAuth & Permissions > Scopes > Bot Token Scopes, add
`incoming-webhook` permission
    - install the app
    - webhook url is available under Features > Incoming Webhooks
- Create a rule that can be triggered with available documents and
attach observability AI assistant connector. (I use `Error Count
Threshold` and generate errors via `node scripts/synthtrace
many_errors.ts --live`)
- configure the connector with one genai connector and a message with
instructions. Example:
```
High error count alert has triggered. Execute the following steps:
  - create a graph of the error count for the service impacted by the alert for the last 24h
  - to help troubleshoot recall past occurrences of this alarm, also any other active alerts. Generate a report with all the found informations and send it to slack connector as a single message. Also include the link to this conversation in the report
```
- Track alert status and verify connector was executed. You should get a
slack notification sent by the assistant, and a new conversation will be
stored

TODO
- unit/integration tests - see
https://github.com/elastic/kibana/pull/168369 for reference
implementation
- documentation

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2024-04-15 22:22:06 +02:00
Christos Nasikas
b735d8c569
[Cases] Case action (#168369)
## Summary

Depends on: https://github.com/elastic/kibana/pull/166267,
https://github.com/elastic/kibana/pull/170326,
https://github.com/elastic/kibana/pull/169484,
https://github.com/elastic/kibana/pull/173740,
https://github.com/elastic/kibana/pull/173763,
https://github.com/elastic/kibana/pull/178068,
https://github.com/elastic/kibana/pull/178307,
https://github.com/elastic/kibana/pull/178600,
https://github.com/elastic/kibana/pull/180437

PRs:
- https://github.com/elastic/kibana/pull/168370
- https://github.com/elastic/kibana/pull/169229
- https://github.com/elastic/kibana/pull/171754
- https://github.com/elastic/kibana/pull/172709
- https://github.com/elastic/kibana/pull/173012
- https://github.com/elastic/kibana/pull/175107
- https://github.com/elastic/kibana/pull/175452
- https://github.com/elastic/kibana/pull/175505
- https://github.com/elastic/kibana/pull/177033
- https://github.com/elastic/kibana/pull/178277
- https://github.com/elastic/kibana/pull/177139
- https://github.com/elastic/kibana/pull/179796

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

## Testing

Run Kibana with `--run-examples` if you want to use the "Always firing"
rule.

Create a rule with a case action in observability and the stack. The
security solution is not supported. You should not be able to assign a
case action in a security solution rule.

1. Test the "Reopen closed cases" configuration.
2. Test the "Grouping by" configuration. Only one field is allowed. Not
all fields are persisted in alerts. If you select a field not part of
the alert the case action will create a case where the grouping value is
set to `unknow`.
3. Test the "Time window" feature. You can comment out the validation to
test for shorter times.
4. Verify that the case action is experimental.
5. Verify that based on the rule type the case is created in the correct
solution.
6. Verify that you cannot create a rule with the case action on the
basic license.
7. Verify that the execution of the case action fails if you do not have
permission for cases. Pending work on the system actions framework level
to not allow users to create rules with system actions where they do not
have permission.
8. Stress test the case action by creating multiple rules.

### 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

### 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)

## Release notes

Automatically create cases when an alert is triggered.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: adcoelho <antonio.coelho@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
2024-04-12 12:01:17 +03:00
Ersin Erdal
2abe492033
Remove skipping task logic from Task Manager (#177244)
Towards: #176585

This PR removes the task skipping logic from TaskManager, PRs for
Alerting and Actions will follow.

## To verify
Rules and actions should be still working as expected.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-03-14 15:52:56 +01:00
Ying Mao
7f5486e1e6
[Response Ops][Task Manager ] Adding ability for ad-hoc task instance to specify timeout override (#175731)
Resolves https://github.com/elastic/kibana/issues/174353

## Summary

Adds ability for task instance to specify a timeout override that will
be used in place of the task type timeout when running an ad-hoc task.
In the future we may consider allowing timeout overrides for recurring
tasks but this PR limits usage to only ad-hoc task runs.

This timeout override is planned for use by backfill rule execution
tasks so the only usages in this PR are in the functional tests.
2024-02-15 13:21:37 -05:00
Ying Mao
b5225232d0
[Response Ops][Task Manager] Introduce task priority during task claiming (#175334)
Resolves https://github.com/elastic/kibana/issues/174352

## Summary

Adds an optional `priority` definition to task types which defaults to
`Normal` priority. Updates the task claiming update by query to include
a new scripted sort that sorts by priority in descending order so that
highest priority tasks are claimed first.

This priority field is planned for use by backfill rule execution tasks
so the only usages in this PR are in the functional tests.

Also included an integration test that will ping the team if a task type
explicitly sets a priority in the task definition

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-02-15 09:40:48 -05:00