Commit graph

47065 commits

Author SHA1 Message Date
Anton Dosov
1b8ec4efa8
[Search] Reuse uiSettings within bsearch request (#114088) 2021-10-07 09:51:45 +02:00
Clint Andrew Hall
78021330c7
[fleet][unified integrations] Fix flaky test (#114202) 2021-10-07 09:51:18 +02:00
Shahzad
e388648f9d
[Uptime] Move Monitor list histogram to async search (#113528)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 09:48:14 +02:00
David Sánchez
9a31e86c5c
[Security Solution][Endpoint] Display empty state UI on the artifacts subtab of policy details when no trusted application exist (#113802)
* 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
2021-10-07 09:33:46 +02:00
Uladzislau Lasitsa
280d1d84b4
Add savedSearchId when we update state with searchSource (#113938)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 10:30:03 +03:00
Spencer
b9f0965381
[failed-test-reporter/es-config] add new sub-fields in mapping (#114200)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-10-07 00:12:46 -05:00
Matthew Kime
202980e887
[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>
2021-10-06 23:13:21 -05:00
Nathan Reese
a67eef4c31
[Maps] fix typings for optionalPlugins (#114103) 2021-10-06 18:24:28 -06:00
Nathan Reese
c2aeac5141
[Maps] do not lazy load setup API methods (#114150)
* [Maps] do not lazy load setup API methods

* remove test code
2021-10-06 18:24:15 -06:00
Scotty Bollinger
758eb157f4
[Workplace Search] Update Source Frequency views to match new designs (#114157)
* 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
2021-10-06 19:46:24 -04:00
Brandon Kobel
a4ee087fd7
Reverting to legacy ES client behavior where maxSockets = Infinity (#113644)
* Reverting to legacy ES client behavior where maxSockets = Infinity

* Removing unnused type

* Specifying keepAlive: true by default

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 16:18:58 -07:00
Thom Heymann
94b2e30bd7
Interactive Setup UI enhancements (#113011) 2021-10-06 23:56:42 +01:00
Brian Seeders
4d8d7ee0ad
[buildkite] Several small tweaks and cleanup (#114006) 2021-10-06 18:56:30 -04:00
Jonathan Budzenski
9df3db075f
[config] Remove leading spaces from logging configuration (#114168)
* [config] Remove leading spaces from logging configuration

This is a consistency check with other areas of the stack and other
configurations in kibana.yml.

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

* Update kibana.yml
2021-10-06 17:46:33 -05:00
Andrew Goldstein
530663217c
[Security Solution] Increases code coverage in the timelines plugin (#113681)
## [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))
2021-10-06 16:18:48 -06:00
Brian Seeders
170ed4b0ac
[buildkite] Move PR config into the master branch (#113986) 2021-10-06 22:57:06 +01:00
Frank Hassanabad
3237a746ae
[Security Solution] Migrates siem-detection-engine-rule-actions ruleAlertId and actions to saved object references array (#113577)
## 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
2021-10-06 17:52:28 -04:00
Byron Hulcher
3135075250
[App Search] Split Curation Detail views into tabs (#114117) 2021-10-06 17:17:33 -04:00
Stacey Gammon
6723fa583f
Add packages to our API documentation (#113564)
* Add packages

* Update docs

* Fix test and types

* debug heap size

* remove debug heap line

* updated docs
2021-10-06 17:02:57 -04:00
Cauê Marcondes
e5e27cc863
[APM] Updating default option for searchAggregatedTransactions setting (#114174)
* updating default option for searchAggregatedTransactions setting

* updating
2021-10-06 15:47:47 -04:00
Zacqary Adam Xeper
cc84798f10
[Monitoring] Migrate Elasticsearch ML Jobs View from Angular (#113974)
* [Monitoring] Migrate Elasticsearch ML Jobs View from Angular

* Add types

* Fix broken node links
2021-10-06 15:17:35 -04:00
Luke Elmers
f030960c98
[logging] Upgrade ECS to 8.0 (#113662) 2021-10-06 14:37:43 -04:00
spalger
3a9aa78458 skip flaky suite (#105171) 2021-10-06 18:16:57 +00:00
Kyle Pollich
fd16d4c740
[Fleet] Fix Policy Upgrades for packages with multiple policy templates (#114011)
* Fix stream mapping issue for multiple policy templates

* Add tests for enabled/disabled streams/inputs and multiple policy template cases

* Remove commented console.log
2021-10-06 14:08:38 -04:00
Kyle Pollich
59d23af973
[Fleet] Improve default settings for Fleet component templates (#114101)
* Improve default settings for Fleet component templates

* Fix failing integration test

* Fix another failing integration test
2021-10-06 14:06:20 -04:00
spalger
ce489a1131 skip flaky suite (#113130) 2021-10-06 18:06:05 +00:00
James Gowdy
89d2e264f1
[ML] Job sync usability improvements (#112693)
* [ML] Job sync usability improvements

* changing tranlation id

* updating translations

* adding refesh to overview page

* updating tests

* refresh improvements

* updating test

* fixing blocking job id check

* fixes tests

* adding new endpoint to perform sync check

* adding tests for new endpoint

* comment updates

* changes based on review

* adding mounted check

* updating route id

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 19:04:22 +01:00
Søren Louv-Jansen
10fd800c2a
[APM] Add "Queries and data model" section to APM readme (#114025) 2021-10-06 12:59:43 -05:00
spalger
0dcd3d3dca fix eslint warning in fleet 2021-10-06 16:34:48 +00:00
ymao1
e04de9bda3
Wrapping text on create rule flyout (#113305)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 12:34:37 -04:00
Dima Arnautov
6da1323ff5
[Transform] Transforms health alerting rule type (#112277) 2021-10-06 18:27:24 +02:00
Chris Roberson
f8611470e6
[Alerting] Track deprecated configs (#113015)
* Track deprecated configs

* PR feedback

* Be more careful

* Add test back in

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 12:09:35 -04:00
Lee Drengenberg
00de78da2b
refactor a11y tests to group by data sets (#113876)
* test if 2s sleep fixes flakey test

* switch from sleep to retry.waitFor

* remove .only, add comments to config file about sample data add/remove

* refactor a11y tests for sample data load

* refactor a11y tests for sample data load

* cleanup comments

* cleanup comments

* fix eslint errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 11:09:03 -05:00
Felix Stürmer
ba0190a21e
[Metrics UI] Fix metric threshold alert reason message for gte/lte comparator (#114080) 2021-10-06 17:55:42 +02:00
spalger
4e41894459 skip suite failing es promotion (#114030) 2021-10-06 15:51:08 +00:00
Peter Pisljar
1a577dfbfa
filter types (#111269) 2021-10-06 17:46:54 +02:00
Tyler Smalley
b59e3ff460
[vscode] Set typescript.tsserver.maxTsServerMemory (#113959)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-10-06 08:11:12 -07:00
Jack
e16495792f
Fix long agent policy name accessibility in add/edit integration (#113828) 2021-10-06 10:58:04 -04:00
Sandra G
1eceef4fc8
CCR tab pages (#113988)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 10:14:24 -04:00
Tiago Costa
e594deed5a
fix(NA): @kbn/monaco types exports (#113937) 2021-10-06 15:05:39 +01:00
Jonathan Buttner
4243c57ee8
[Cases][Timeline] Adding multiple-isolated changes (#113552)
* Adding multiple-isolated changes

* Working alias match tests

* Adding tests for alias match

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 09:47:47 -04:00
Yuliia Naumenko
b9db370c1a
[Actions][Docs] Modify connector documentation with the new MS Exchange online configuration requirements (#112768)
* [Actions][Docs] Modify connector documentation with the new MS Exchange online configuration requirements

* Added images

* Added client secrets

* fixed test

* fixed links

* Apply suggestions from code review

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* fixed due to comments

* Apply suggestions from code review

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update email.asciidoc

* fixed due to comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2021-10-06 06:42:28 -07:00
Marco Liberati
3fe1eab5a5
[Lens] Thresholds: auto fit thresholds into vertical axis (#113238)
*  Make threshold fit into view automatically

* 🐛 do not compute axis threshold extends if no threshold is present

*  One more fix for 0-based extends and tests

* 📝 fix typo

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 15:39:44 +02:00
James Rodewig
634cd80c7e
[TSVB] Update copy for TSVB setting popover (#113990)
The TSVB data view popover includes additional copy if the **Allow string indices in TSVB** Kibana setting is disabled (the default). This updates the copy to better align with changes in https://github.com/elastic/kibana/pull/110253.
2021-10-06 08:54:54 -04:00
Caroline Horn
74da7d30de
[Observability] New "No Data" screens (#107709)
Adds empty states for all of Obs that lead to their various ingest flows.
2021-10-06 08:50:10 -04:00
Stratoula Kalafateli
fa59b52e9a
Fixes problem with one chart plotted for multiple y axis when migrating from an old SO (#112972)
* Fixes problem with one chart plotted for multiple y axis when migrationg from an old SO

* Add unit tests

* Address PR comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 15:37:04 +03:00
Phillip Burch
7c27822687
[Stack Monitoring] Logstash migration (#113256) 2021-10-06 07:09:39 -05:00
Jason Stoltzfus
bee6543e18
[App Search] Wired up existing promoted documents on suggestion view (#113967) 2021-10-06 08:09:00 -04:00
Tiago Costa
f43b4477ad
skip flaky suite (#113695) 2021-10-06 12:53:06 +01:00
Pierre Gayvallet
0e406d167e
add coreOverall$ to internal status contract (#113729)
* add coreOverall$ to internal status contract

* add unit tests

* re-patch flaky tests

* add and improve tests
2021-10-06 13:49:46 +02:00