Commit graph

17746 commits

Author SHA1 Message Date
Nathan L Smith f6e4f1b225
Relocate internal APM API endpoints to /internal (#114196) (#114494)
All endpoints except annotations, source maps, and agent configuration are now at /internal/apm instead of /api/apm.

None of the UX endpoints have been updated, only APM.

If you search for "/api/apm" in the codebase, you should only see the above endpoints.

Fixes #113383.
# Conflicts:
#	x-pack/plugins/apm/public/components/shared/MetadataTable/ErrorMetadata/index.tsx
#	x-pack/plugins/apm/public/components/shared/MetadataTable/SpanMetadata/index.tsx
#	x-pack/plugins/apm/public/components/shared/MetadataTable/TransactionMetadata/index.tsx
#	x-pack/plugins/apm/server/routes/event_metadata.ts
#	x-pack/test/apm_api_integration/tests/metadata/event_metadata.ts
#	x-pack/test/apm_api_integration/tests/services/throughput.ts
2021-10-11 12:12:32 -04:00
Kibana Machine 50908d8542
[Security Solution] Add host isolation exception IPs UI (#113762) (#114490)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Esteban Beltran <academo@users.noreply.github.com>
2021-10-11 11:51:31 -04:00
Giorgos Bamparopoulos 6047f03138
Add all APM configuration settings to the documentation (#114139) (#114488)
* Add APM configuration settings to the documentation

* Rename  the deprecated apm_oss.* configurations to xpack.apm.*

* Remove new lines

* Add ess icon to config settings

* Add link to the APM configuration settings docs

Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>

Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-11 11:42:04 -04:00
Jean-Louis Leysens db7794f536
[Reporting] Update chromium exit behaviour (#113544) (#114464)
* move uncaught exception out of exit$

* reintroduce original error, but as a log instead

* change log level: error -> warning. also update copy to make it explicit that the error will be ignored

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-11 11:39:12 -04:00
Kibana Machine e190acd1cf
[Visualize] unskip the reporting funtional test (#114094) (#114461)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2021-10-11 09:00:10 -04:00
Tiago Costa e7bec3091d
skip flaky suite (#106053) 2021-10-11 13:50:55 +01:00
Tiago Costa 60cf849ac7
skip flaky suites (#114418) 2021-10-11 13:44:50 +01:00
Tiago Costa d780173fba
skip flaky suites (#100951) 2021-10-11 13:37:46 +01:00
Tiago Costa e1443521c8
skip flaky suites (#114417) 2021-10-11 13:25:40 +01:00
Tiago Costa 0eccae9670
skip failing es promotion suites (#114471) 2021-10-11 13:23:01 +01:00
Esteban Beltran b528572d38
[Security Solution] host isolation exceptions delete item UI (#113541) (#114435)
Co-authored-by: David Sánchez <davidsansol92@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: David Sánchez <davidsansol92@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-11 06:09:44 -04:00
Kibana Machine 7f83f297c9
Update APM queries development doc (#114268) (#114440)
* Add links to field references and GET requests to the examples

* Add troubleshooting info for failed requests

* Add data model and running examples section

* Add GET requests for query examples

* Add `metricset` possible values

Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>

* Add transaction based and metric based queries

Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>

Co-authored-by: Giorgos Bamparopoulos <georgios.bamparopoulos@elastic.co>
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
2021-10-11 04:51:18 -04:00
Kibana Machine 3631bd3c43
[Fleet] Display upgrade integration button instead of save for upgrades (#114314) (#114430)
* Display upgrade integration button instead of save for upgrades

* Skip endpoint tests

* Revert "Skip endpoint tests"

This reverts commit 3cfd100171.

Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
2021-10-11 02:10:21 -04:00
Joe Portner 7053f5b16b
Legacy url conflict UI improvements (#114172) (#114382)
# Conflicts:
#	docs/development/core/public/kibana-plugin-core-public.doclinksstart.md

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-09 18:50:51 -04:00
Sébastien Loix 8e3445c16a
[Watcher] Use fixed_interval instead of interval (#113527) (#114410) 2021-10-09 12:17:49 -04:00
Kibana Machine c854dfdbf8
[Fleet] Add installed integration callouts (#113893) (#114409)
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Thomas Neirynck <thomas@elastic.co>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
2021-10-09 05:15:04 -04:00
Jonathan Budzenski 863ac83097 skip flaky test. #112922 2021-10-08 11:20:55 -05:00
Jonathan Budzenski 61ec6f3a9f skip failing es promotion suites. #111240 2021-10-08 11:00:10 -05:00
Jonathan Budzenski 23f26ee3f3 skip flaky test. #114261 2021-10-08 10:51:41 -05:00
Kibana Machine 67e3caf587
[Stack Monitoring] sync timepicker with url (#114290) (#114388)
* sync timepicker hook with url

* name function

* fix linter errors

Co-authored-by: Kevin Lacabane <kevin.lacabane@elastic.co>
2021-10-08 09:50:35 -04:00
Shahzad c2ec5ead34
[Exploratory View] Embedddable component (#113108) (#114311)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-08 06:37:26 -04:00
Yaroslav Kuznietsov 0058764851
[MetricVis] Move the expression function and renderer to a separate plugin. (#113427) (#114384)
* Added expressionMetricVis plugin.

* splitted metric vis_type and expression.

* Fixed check errors.

* Fixed plugin docs.

* updated snapshots.

* Added code owner to expressionMetricVis.

* updated chart docs.

* Changed the `Metric` type export.

* Added storybook.

* Added bucket story.

* Added without label story.

* Added "with custom font size" story.

* Added other stories.

* Added DatatableColumn accessors.

* Replaced Metric with MetricOptions.

* Fixed MetricOptions.any

* updated the check of min/max existence.

* Updated function/renderer names.

metricRenderer -> metricVisRenderer
metricFunction -> metricVisFunction

* updated snapshot.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	.github/CODEOWNERS
#	packages/kbn-optimizer/limits.yml
#	src/dev/code_coverage/ingest_coverage/__tests__/enumerate_patterns.test.js
#	src/dev/code_coverage/ingest_coverage/__tests__/transforms.test.js
2021-10-08 04:28:29 -04:00
Kibana Machine 0fd4aeae93
[Fleet] Revert max fields value for Fleet component templates to 10k (#114299) (#114373)
* Revert max fields value for Fleet component templates to 10k

* Skip endpoint tests

* fix failing spec

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
2021-10-07 20:53:38 -04:00
Kibana Machine 23adc7f432
[App Search] Wired up action buttons for suggestion detail view (#114183) (#114368)
Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
2021-10-07 20:03:55 -04:00
Kibana Machine d7dc8b4d50
[ML] Fix deletion of models that are not used by pipelines (#114107) (#114355)
* [ML] Fix deletion of models that are not used by pipelines

* [ML] Edits from review

* [ML] Fix jest test for index switch in delete job modal

* [ML] Fix API test calls to createTestTrainedModels

* [ML] Remove unnecessary async from jest test

Co-authored-by: Pete Harverson <peteharverson@users.noreply.github.com>
2021-10-07 18:32:36 -04:00
Matthew Kime 8b50d70a36
[7.x] [data views] clarify field subtype typescript types (#112499) (#114222)
* [data views] clarify field subtype typescript types (#112499)

* separate out multi and nested subTypes

* separate out multi and nested subTypes

* add undefined checks

* remove expect error statements

* use helper functions in es-query

* simplify changes with helper functions

* checking existence instead of getting value x2

* simplify types and revert discover changes

* update discover sidebar with helper methods

* try helpers with group_fields file

* try different helper with group_fields file

* revert group field changes, try nested field helpers

* revert nested field changes, try field_name.tsx helpers

* fix maps jest test

* use helpers in discover instead of setting types

* fix field_name.tsx

* Update index_pattern_util.test.ts

* lint  fix

* fix common exports

* reduce data_views plugin bundle size

* reduce data_views plugin bundle size

* remove discover reliance on es-query package

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	packages/kbn-es-query/src/es_query/handle_nested_filter.ts

* fix test
2021-10-07 17:49:42 -04:00
Kibana Machine b6c75ee752
[7.x] [Fleet] Add language clients (#113666) (#113977)
* [Fleet] Add language clients (#113666)

* Apply suggestions from code review

Co-authored-by: Lisa Cawley <lcawley@elastic.co>

* Update src/plugins/custom_integrations/server/plugin.test.ts

Co-authored-by: Lisa Cawley <lcawley@elastic.co>

* Update src/plugins/custom_integrations/server/plugin.test.ts

Co-authored-by: Lisa Cawley <lcawley@elastic.co>

Co-authored-by: Thomas Neirynck <thomas@elastic.co>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
Co-authored-by: Lisa Cawley <lcawley@elastic.co>
2021-10-07 21:44:07 +00:00
Joe Portner b63428a70a
[7.x] Remove securityOss plugin (#113946) (#114322)
* Remove securityOss plugin (#113946)

# Conflicts:
#	.eslintrc.js
#	.github/CODEOWNERS
#	api_docs/security_oss.mdx
#	packages/kbn-optimizer/limits.yml
#	scripts/functional_tests.js
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json

* Add unintentionally removed translations

* Fix jest test
2021-10-07 16:45:09 -04:00
Kibana Machine a94d4cc5de
[Fullstory] Report mem usage (#114108) (#114325)
* memory

* jest test

* typo

Co-authored-by: Liza Katz <lizka.k@gmail.com>
2021-10-07 15:32:20 -04:00
Kibana Machine a3e390f924
[App Search] General UX Improvements for Curations and Suggestions (#114213) (#114312)
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
2021-10-07 14:03:20 -04:00
Patryk Kopyciński 9ef198ad0d
Bump eslint@7 (#94347) (#114256)
# Conflicts:
#	packages/elastic-eslint-config-kibana/javascript.js
#	packages/kbn-eslint-plugin-eslint/rules/disallow_license_headers.test.js
#	packages/kbn-eslint-plugin-eslint/rules/no_restricted_paths.test.js
#	packages/kbn-eslint-plugin-eslint/rules/require_license_header.test.js
#	src/dev/eslint/lint_files.ts
#	x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/timeline/processor.tsx
#	yarn.lock

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 13:35:23 -04:00
Kibana Machine 8e9c74b5d4
[Fleet] Report installing status while package install is in progress (#111875) (#114296)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
2021-10-07 13:20:58 -04:00
Jonathan Budzenski a19a28da9c add details to skipped test 2021-10-07 11:36:05 -05:00
Jonathan Budzenski ddd12161d3 skip flaky suite 2021-10-07 11:22:54 -05:00
Jonathan Budzenski 4c8448919b skip flaky suite, #114249, #114250 2021-10-07 10:54:37 -05:00
Tyler Smalley ba2addfce2 skip flaky suite (#113496) 2021-10-07 10:50:39 -05:00
Nathan Reese 7109faf257
[7.x] [Maps] fix typings for optionalPlugins (#114103) (#114221)
* [Maps] fix typings for optionalPlugins (#114103)

# Conflicts:
#	x-pack/plugins/maps/server/maps_telemetry/collectors/register.ts

* tslint

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 11:48:06 -04:00
Kibana Machine 38f49bbd07
Fix undhandle promise rejection (#114233) (#114281)
Co-authored-by: Miriam <31922082+MiriamAparicio@users.noreply.github.com>
2021-10-07 11:44:05 -04:00
Kibana Machine 7555dfc633
[Lens] Chart is not updating with Refresh button (#114135) (#114255)
Co-authored-by: Marta Bondyra <marta.bondyra@gmail.com>
2021-10-07 09:26:33 -04:00
Kibana Machine bbaec75321
Add Host Risk metadata data to alerts flyout (#113274) (#114238)
* Filter out empty values from alert flyout overview

* Add Host Risk metadata data to alerts flyout

* Add feature flag to host risk data query

* Swap investigation guide and enrichment data places in the UI

* Migrate alert_summary_view.test to react testing library

* Refactor threat summary by extracting components and renaming

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
2021-10-07 07:36:43 -04:00
Kibana Machine c07e45232e
[Osquery] 7.15 osquery bug squash (#113325) (#114236)
* integration policies fixes

* don't update scheduled query group name while importing pack if there's already a name set

* handle reseting form state on submission error

* nixed the console logging

* fix linting issues

* useFormData instead of getFields

* linter plz

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Bryan Clement <bclement01@gmail.com>
2021-10-07 06:49:55 -04:00
Kibana Machine 54d903ad41
[Uptime] Annotate waterfall chart with additional metrics (#103642) (#113898)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
2021-10-07 10:17:09 +00:00
Kibana Machine 98ed6680ba
[Security Solution][Endpoint] Display empty state UI on the artifacts subtab of policy details when no trusted application exist (#113802) (#114226)
* Adds new empty prom when there is no TA or non already assigned one

* Adds policy name to text message

* Fix error in tabs component

* Fix mulilangs in empty state components

* API call that checks if any TA exists with actions and reducers

* Adds current policy id and name to the empty state component instead of a fake ones

* Adds unit test for layout

* Switch empty state depending on results and added unit test

* Fix multilang keys and join code into a hook to avoid duplications

* Fix TS error

* Canges icon

* Fixes pr comments

* Fix ts error in test

Co-authored-by: David Sánchez <davidsansol92@gmail.com>
2021-10-07 06:01:35 -04:00
Nathan Reese 56f0be0d41
[Maps] do not lazy load setup API methods (#114150) (#114220)
* [Maps] do not lazy load setup API methods

* remove test code
# Conflicts:
#	x-pack/plugins/maps/public/lazy_load_bundle/index.ts
2021-10-07 00:42:58 -04:00
Kibana Machine e48930292f
[Workplace Search] Update Source Frequency views to match new designs (#114157) (#114212)
* Add schema for blocked_windows and blockedWindows type

* Update constants and types

Also changes the size of a spacer

* Update FrequencyItem to new design

* Update BlockedWindowItem to new design

* Update logic file for new designs

It was decided that we would omit the seconds from any API-submitted duration values.

* Add i18n for UTC tooltip

* Better function name

Also moved const closer to function declarations for easier readability

* Add reducers

CI was complaining about types since the method wasn’t used. Was going to add these in a future PR but will add them here so we can merge

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
2021-10-06 22:27:11 -04:00
Kibana Machine f27ec3ff60
[Security Solution] Increases code coverage in the timelines plugin (#113681) (#114205)
## [Security Solution] Increases code coverage in the `timelines` plugin

This PR is the first in a series that increases code coverage in the `timelines` plugin, as part of <https://github.com/elastic/kibana/issues/111581>

### Methodology

1. Code coverage is measured by running the following command:

```
cd $KIBANA_HOME/x-pack && node scripts/jest.js timelines --coverage
```

The above command outputs the following coverage report:

```
kibana/target/kibana-coverage/jest/index.html
```

2. The coverage report is used to determine which paths need coverage, and measure coverage before / after tests are updated, as illustrated by the screenshots below:

**Before (example)**

![file-summary-before](https://user-images.githubusercontent.com/4459398/135690108-f90839b1-1450-4083-b928-5c5d99f1151d.png)

![file-coverage-before](https://user-images.githubusercontent.com/4459398/135690178-be24e716-545f-425f-bcd5-480026fcad1f.png)

**After (example)**

![file-summary-after](https://user-images.githubusercontent.com/4459398/135690267-7e94655f-4852-42f7-8180-8c195dd77e8b.png)

![file-coverage-after](https://user-images.githubusercontent.com/4459398/135690232-63130180-3fa1-4989-ac69-d8af7cc8fc95.png)

### React Testing Library vs Enzyme

- New test files are created using [React Testing Library](https://github.com/testing-library/react-testing-library) by default

- [Enzyme](https://github.com/enzymejs/enzyme) tests will only be used as a fallback when it's not reasonably possible to express the test in React Testing Library

- Code will (still) be instrumented to use `data-test-subj` in alignment with the Kibana [STYLEGUIDE](https://github.com/elastic/kibana/blob/master/STYLEGUIDE.mdx#camel-case-id-and-data-test-subj)

- When possible, the `getByRole` and other [higher priority](https://testing-library.com/docs/queries/about#priority) query APIs will be used in Jest tests, as opposed to selecting via `getByTestId` + `data-test-subj`. This follows the [guidance from React Testing Library](https://testing-library.com/docs/queries/about#priority).

- Note: Jest was already configured to use the `getByTestId` API with `data-test-subj` [here](4a54188355/packages/kbn-test/src/jest/setup/react_testing_library.js (L20))

Co-authored-by: Andrew Goldstein <andrew-goldstein@users.noreply.github.com>
2021-10-06 20:50:53 -04:00
Kibana Machine fc0606daf2
[Security Solution] Migrates siem-detection-engine-rule-actions ruleAlertId and actions to saved object references array (#113577) (#114201)
## Summary

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

* Migrates the legacy `siem-detection-engine-rule-actions` `ruleAlertId` and `actions` to saved object references arrays
* Adds an e2e test for `siem-detection-engine-rule-actions`
* Updates the types to work with the migrations and the new and old data structures.
* Decouples and removes reliance on alerting within the types since we do not want development of alerting to get in the way of legacy things and have migration changes by accident.
* Updates the REST interface and code to produce post migration data structures. Removes some types and code where w can since those parts are no longer needed/used.
* Adds `actionRef` to the mapping

Before migration you should see data structures like this if you query:
```json
GET .kibana/_search
{
  "query": {
    "term": {
      "type": {
        "value": "siem-detection-engine-rule-actions"
      }
    }
  }
}
```

```json
{
  "siem-detection-engine-rule-actions": {
    "ruleAlertId": "fb1046a0-0452-11ec-9b15-d13d79d162f3", <-- ruleAlertId which we want in the references array and removed
    "actions": [
      {
        "action_type_id": ".slack",
        "id": "f6e64c00-0452-11ec-9b15-d13d79d162f3", <-- id which we want in the references array and removed
        "params": {
          "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
        },
        "group": "default"
      }
    ],
    "ruleThrottle": "7d",
    "alertThrottle": "7d"
  },
  "type": "siem-detection-engine-rule-actions",
  "references": [], <-- Array is empty which instead needs the id's of alerts and actions
  "migrationVersion": {
    "siem-detection-engine-rule-actions": "7.11.2"
  },
  "coreMigrationVersion": "7.14.0",
  "updated_at": "2021-09-15T22:18:48.369Z"
}
```

After migration you should see data structures like this:
```json
{
  "siem-detection-engine-rule-actions": {
    "actions": [
      {
        "action_type_id": ".slack",
        "actionRef" : "action_0", <-- We use the name and "actionRef" to be consistent with kibana alerting
        "params": {
          "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
        },
        "group": "default"
      }
    ],
    "ruleThrottle": "7d",
    "alertThrottle": "7d"
  },
  "type": "siem-detection-engine-rule-actions",
  "references" : [
    {
      "name" : "alert_0", <-- Name is "alert_0"
      "id" : "fb1046a0-0452-11ec-9b15-d13d79d162f3", <-- Alert id is now here
      "type" : "alert" <-- Type should be "alert"
    },
    {
      "name" : "action_0", <-- Name is "action_0" and should be the same as kibana alerting names theirs for consistencty
      "id" : "f6e64c00-0452-11ec-9b15-d13d79d162f3", <-- Id of the action is now here.
      "type" : "action" <-- Type should be "action"
    }
  ],  
  "migrationVersion": {
    "siem-detection-engine-rule-actions": "7.16.0"
  },
  "coreMigrationVersion": "8.0.0",
  "updated_at": "2021-09-15T22:18:48.369Z"
}
```

Manual testing
---
There are e2e tests but for any manual testing or verification you can do the following:

If you have a 7.14.0 system and can migrate it forward that is the most straight forward way to ensure this does migrate correctly and forward. You should see that the legacy notification system still operates as expected.

If you are a developer off of master and want to test different scenarios then this section is for below as it is more involved and harder to do but goes into more depth:

* Create a rule and activate it normally within security_solution
* Do not add actions to the rule at this point as we are exercising the older legacy system. However, you want at least one action configured such as a slack notification.
* Within dev tools do a query for all your actions and grab one of the `_id` of them without their prefix:

```json
# See all your actions
GET .kibana/_search
{
  "query": {
    "term": {
      "type": "action"
    }
  }
}
```

Mine was `"_id" : "action:879e8ff0-1be1-11ec-a722-83da1c22a481"`, so I will be copying the ID of `879e8ff0-1be1-11ec-a722-83da1c22a481`

Go to the file `detection_engine/scripts/legacy_notifications/one_action.json` and add this id to the file. Something like this:

```json
{
  "name": "Legacy notification with one action",
  "interval": "1m",  <--- You can use whatever you want. Real values are "1h", "1d", "1w". I use "1m" for testing purposes.
  "actions": [
    {
      "id": "879e8ff0-1be1-11ec-a722-83da1c22a481", <--- My action id
      "group": "default",
      "params": {
        "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
      },
      "actionTypeId": ".slack" <--- I am a slack action id type.
    }
  ]
}
```

Query for an alert you want to add manually add back a legacy notification to it. Such as:

```json
# See all your siem.signals alert types and choose one
GET .kibana/_search
{
  "query": {
    "term": {
      "alert.alertTypeId": "siem.signals"
    }
  }
}
```

Grab the `_id` without the alert prefix. For mine this was `933ca720-1be1-11ec-a722-83da1c22a481`

Within the directory of detection_engine/scripts execute the script:

```json
./post_legacy_notification.sh 933ca720-1be1-11ec-a722-83da1c22a481
{
  "ok": "acknowledged"
}
```

which is going to do a few things. See the file `detection_engine/routes/rules/legacy_create_legacy_notification.ts` for the definition of the route and what it does in full, but we should notice that we have now:

Created a legacy side car action object of type `siem-detection-engine-rule-actions` you can see in dev tools:

```json
# See the actions "side car" which are part of the legacy notification system.
GET .kibana/_search
{
  "query": {
    "term": {
      "type": {
        "value": "siem-detection-engine-rule-actions"
      }
    }
  }
}
```

Take note that this actually creates the rule migrated since this PR updated the code to produce new side cars. So we have to use some scripting to change the actions to utilize the old format.  However, before continuing you should verify that this does fire correctly and that the new format is working as expected. After that replace the structure with the older structure like so below and downgrade the migration version so that we can restart Kibana and ensure that this does migrate correctly forward:

```json
# Get your id of your rules side car above and then use this script to downgrade the data structure
POST .kibana/_update/siem-detection-engine-rule-actions:210f4c90-2233-11ec-98c6-ed2574588902
{
  "script" : {
    "source": """
    ctx._source.migrationVersion['siem-detection-engine-rule-actions'] = "7.15.0";
    ctx._source['siem-detection-engine-rule-actions'].actions[0].id = ctx._source.references[1].id;
    ctx._source['siem-detection-engine-rule-actions'].actions[0].remove('actionRef');
    ctx._source['siem-detection-engine-rule-actions'].ruleAlertId = ctx._source.references[0].id;
    ctx._source.references.remove(0);
    ctx._source.references.remove(0);
    """,
    "lang": "painless"
  }
}
```

Restart Kibana and now it should be migrated correctly and the system should fire the notifications as expected. You shouldn't see any errors in your console.

In the scripts folder execute the `find_rules.sh` and expect to see actions like so in the rule with the `id` still in the REST interface and we shouldn't see `actionRef` within the actions:

```json
"actions": [{
  "id": "42534430-2092-11ec-99a6-05d79563c01a",
  "group": "default",
  "params": {
    "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
  },
  "action_type_id": ".slack"
}],
```

Take the rule id and query that as well using `./get_rule_by_id.sh`  and verify that the action also looks the same and is present within the rule.

You can also verify all of this within the UI's as well for rules to ensure the action is still present and as we expect it to be and work.

### Checklist

Delete any items that are not applicable to this PR.

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

Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
2021-10-06 20:27:05 -04:00
Kibana Machine 3dbfd7525e
[App Search] Split Curation Detail views into tabs (#114117) (#114192)
Co-authored-by: Byron Hulcher <byronhulcher@gmail.com>
2021-10-06 19:47:40 -04:00
Kibana Machine 15dca3678a
[APM] Add "Queries and data model" section to APM readme (#114025) (#114161)
Co-authored-by: Søren Louv-Jansen <sorenlouv@gmail.com>
2021-10-06 23:34:32 +00:00
Kibana Machine 52bad5399b
[Monitoring] Migrate Elasticsearch ML Jobs View from Angular (#113974) (#114176)
* [Monitoring] Migrate Elasticsearch ML Jobs View from Angular

* Add types

* Fix broken node links

Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com>
2021-10-06 17:48:15 -04:00