Commit graph

3941 commits

Author SHA1 Message Date
Rashmi Kulkarni ec75f71d4c
Timelion tests- migrate to kbnArchiver from esArchiver (#103969)
* Timelion tests- migrate to kbnArchiver

* added the logic to handle custom space

* paths and version changed
2021-07-01 11:18:14 -07:00
Jonathan Buttner 9dc303a4c6
Addressing feedback for the migrations (#104104) 2021-07-01 12:12:00 -04:00
Christos Nasikas 644d2ce918
[Detections] Truncate case title in toaster when attaching an alert to case (#103228) 2021-07-01 19:02:11 +03:00
ymao1 7cc112d245
[Task Manager] Fixing typo in field name (#103948)
* Fixing typo

* Fixing typo

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-07-01 10:39:21 -04:00
Bhavya RM 16da1a6dbe
Adding alerts and connectors so to import between versions test (#103968)
* adding alerts and connectors to import/export test

* removing beforeEach

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-07-01 14:13:17 +02:00
Marta Bondyra 6e3df60aba
[Lens] Move editorFrame state to redux (#100858)
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: dej611 <dej611@gmail.com>
2021-07-01 11:00:56 +02:00
Joe Reuter 65ff74ff5a
[Lens] Add functional test for example integration (#103460) 2021-07-01 10:48:34 +02:00
Jonathan Buttner 258d33c120
[Cases] Adding migration tests for owner field added in 7.14 (#102577)
* Adding migration tests for 7.13 to 7.14

* Adding test for connector mapping

* Comments
2021-07-01 11:21:46 +03:00
spalger a06c0f1409 skip flaky suite (#104042) 2021-06-30 21:39:10 -07:00
Felix Stürmer 932108ee95
[RAC] Fix rule registry write flag and turn it off by default (#103646) 2021-06-30 21:44:30 +02:00
Rashmi Kulkarni 4b5ceb3995
addressed the nits from PR 103028 (#103892) 2021-06-30 09:24:52 -07:00
Dario Gieselaar 4b54ccecd3
[APM] Return operationName as part of _inspect response (#103616)
Closes #103448.
2021-06-30 09:49:50 -04:00
Wylie Conlon 39b6597219
[Lens] Formula can be colored by value (#103572)
* [Lens] Formula can be colored by value

* Fix mapColumn test

* Fix tests
2021-06-30 09:47:03 -04:00
Rashmi Kulkarni 4cb979b688
[test] Migrating to kbn_archiver from es_archiver - for the Maps app (#103028)
* converting Maps es_archiver to kbn_archiver

* delete the esArchiver .kibana reference directory

* fix the path of the json file

* use the delete API to delete the missing references populated in the data.json

* fix the path

* kbn_archiver_maps.json

* added the missing ref

* restoring it to use esArchiver

* replace esArchiver to use kbnArchiver

* moved the data.json directly under kbnArchiver

 Please enter the commit message for your changes. Lines starting

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-30 06:36:53 -07:00
Yuliia Naumenko 7b8645e0fc
[Alerting] Fixed search results are not updated when search term is removed on Rules and Connectors page (#103663) 2021-06-30 02:17:07 -07:00
Ryland Herrick 569c209f2c
[Security Solution][CTI] Investigation time enrichment UI (#103383)
* Add pure fn and consuming hook to fetch event enrichment

It's not being invoked yet, but I've added a placeholder where it's
going.

* Move existing enrichment tests to new spec file

This is a rough copy/paste, I'll clean up as I flesh out the new tests.

* Move test constants into tests that use them

* style: declare FC function as an FC

* Extract some inline parsing logic into a helper function

And test it!

* Solidifying enrichment types on the backend

* Declares an enum for our types
* Sets type during indicator match rule enrichment
* Sets type during investigation-time enrichment

* WIP: Enrichment rows are rendered on the alerts summary

There are lots of TODOs here, but this implements the following:

* Fetching investigation-time enrichments from the backend
* Parsing existing enrichments from timeline data
* Merging the two enrichment types together, and rendering them in rows
  as specified

Much of the data-fetching is hardcoded, and this broke the existing
pattern with SummaryView/SummaryRow so that got a little messy; I may
end up just using my own EuiTable but we'll see.

Threat Intel tab is currently broken; that's up next.

* Updates ThreatDetailsView to accept an array of enrichments

The investigation-time enrichments are a little messy because they
contain all the non-ECS fields that indicators contain; other than that,
this is looking good.

Still need to add the new header, and potentially sort the fields.

* Sort our details fields

This promotes sanity for the user.

* Add "view threat intel data" button

This simply opens the threat intel tab.

* Implement header for threat details sections

* Add a basic jest "unit" test around ThreatSummaryView

* Fix remaining tests for components we modified

This also addresses a bug where we were not properly sorting new
enrichments by first_seen; this is covered under the tests that were
fixed.

* Filter out duplicate investigation-time enrichments

Because the enrichment endpoint is dumb and doesn't know about the
existing event or its enrichments, we need to merge these together on
the client to reduce noise and redundant data.

* Add inspect button to investigation enrichments

* Massages the response into the format that the inspect component uses
* Moves stateful fetching of query and persisting in redux to new, more
  specialized hook
* Moves existing enrichment hook to a more suitable location in
  containers/

* Fix failing unit tests

* indicator match rule now specifies `matched.type` as coming from the
  rule
* Inspecting the enrichment query requires use of the redux store, which
  was not previously mocked

* Fix existing CTI cypress tests

This covers the basics of the Alert Summary and Threat Intel tabs; the
investigation-time enrichment functionality is up next.

* Adds a cypress test exercising investigation time enrichment

* Loads more indicators (filebeat data, `threat_indicator2` archive)
  AFTER the rule has executed
* Asserts that those indicators are also found on the alert summary.

* Populate event enrichment call with actual alert fields

This was previously hardcoded during development.

* Add a new field to our suspicious event to trigger enrichment

The existing myhash field will generate an alert due to the way the rule
is written, but the alert had no other fields that would match the
investigation time enrichment. This gives it a source.ip, and updates
the indicator to match.

* Only fetch enrichments data if there are valid event fields

If none of the alert's fields would be relevant to the enrichment query,
then we don't make the request at all.

* Update enrichments matched.typed in integration tests

This field was updated to reflect the source of the match, in this case:
indicator match rules.

* Ensure draggable fields are unique in a multi-match scenario

If a given field matched multiple indicators, then the previous
contextId was not unique as it was based on field/value that matched.
Adding provider to the mix would fix it, except that we're not
guaranteed to have a provider.

I've added both provider (if present) and an index value to the key to
ensure that it's unique.

* Simplify types

This field can never be null, as we always set it in our response.

* Move helper functioons out of shared location and into consuming component

These are unlikely to be used elsewhere.

* Clean up data parsing logic using reduce

This obviates the need for our filter/guard function and the extra loop
that it entails. We have to specify the return value of our reduce fn,
however, but that's mostly equivalent to our type guard.

* Move our general function into a general location

* Extract the concept of "enrichment identifiers"

This was already partially codified with 'buildEnrichmentId,' which is
used to dedup enrichments; this extends the idea to all fields that
could uniquely identify a given indicator.

* Use existing constant as the source of our enrichments query

This is now used by both the overview card and the enrichment query.

* Codify our default enrichment lookback as constants

* Remove unnecessary flexbox

The generic SummaryView component previously had to deal with
multi-valued CTI fields, representing the multiple values coming from
the multiple nested objects with that field.

However, with the new UI we no longer have that constraint, and so the
default columnar style, and the corresponding overriding styles, are no
longer necessary.

* Filter out partial responses in the event enrichment observable

The UI does not currently handle these. We need to test the behavior of
long-running queries with this filter, but this should simplify the
behavior to complete/error until we handle partial responses.

* Display placeholders while event enrichment is loading

Displays a loading spinner in the Threat Intel tab title, and some
loading lines where the enrichments summary is.

* Update our indicator data to be within the last 30 days

This fixes our cypress test, but it's going to start failing again in 30
days. However, by that time I'll have implemented the absolute data
picker, which will allow for a more comprehensive test in addition to us
sidestepping this issue.

* Fix type error with our details tabs

The name prop on a Tab will be rendered as a node, so both strings and
elements are acceptable. This relaxes the types to inherit from the
component itself.

* Fix failing jest tests

The addition of our filtering of the search observable broke this test,
since we now need to implement the search observable.

Rather than do that, we'll instead mock our local hook as that's more
likely to change.
2021-06-30 01:16:24 -04:00
Caroline Horn 7d45fcf8ee
[Page layouts] Some light fixes (#103197)
* [Solution Toolbar] Fixing button border on non-text color versions

* [Alerts] Removed extra wrappers and use EuiPageHeader

* [Logstash] Basic conversion to template

* [Reporting] Adding bottomBorder to page header

* [ML] Fix display of main navigation tabs

* [Stack Management] Fix side nav not updating when going back to landing page

* [Tags] Add spacing after page header

* [License Management] Full width on file uploader

* [Page Template] Fixed `emptyState` default template for pages with side nav

* [Infra] Removing some page header displays in empty states

* [Enterprise Search] Fix some error layouts

* [Index Patterns] Quick fix for empty state

* snaps

* [Page Template] Remove forced padding when `centeredBody`

* small hack for tab padding for ml

* scroll ML page to fix test

* fix test method type signature

Co-authored-by: Dave Snider <dave.snider@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michail Yasonik <michail.yasonik@elastic.co>
2021-06-29 19:50:15 -05:00
Lukas Olson ebf9e5df76
Use new terms enum API for autocomplete value suggestions (#100174)
* Migrate kibana.autocomplete config to data plugin

* Fix CI

* Fix tests

* Use new terms enum API for autocomplete value suggestions

* Add tiers to config

* Re-introduce terms agg and add config/tests for swapping algorithms

* Add data_content and data_cold tiers by default

* Fix types

* Fix maps test

* Update tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-29 14:36:18 -07:00
Steph Milovic c24318ae40
[RAC] [Cases] All cases table column design updates (#103544) 2021-06-29 13:53:56 -06:00
Dario Gieselaar e8584e533b
[APM] Filter on defined environment for latency charts (#103621)
Closes #102047.
2021-06-29 21:45:51 +02:00
Caroline Horn 523cd0fbe5
[KibanaPageTemplate] Adds collapsibility to solutionNav (#103192)
Adds the ability to collapse the sidenav. This should work in all solutions. It also adds breakpoints that turn it into a flyout at lower screen widths.
2021-06-29 15:25:27 -04:00
Sandra Gonzales a7b5d3533e
[Stack Monitoring] create alert per node instead of per cluster (#102544)
* create alert per node instead of per cluster

* add comment

* fix test, replace alert state with empty array with no node is firing

* update cpu usage action messaging

* fix internationalization

* update disk usage rule action messaging

* update memory usage rule action messaging

* update other action messaging

* update missing monitoring data alert action messaging

* remove comment

* fix bug where threadpool alerts were not firing

* fix bug with threadpool rejections and update alert action messaging to be per node

* update comments

* unit test for thread pool write rejections alert

* update messaging for CCR read rejection

* fix cluster level alerts to use the cluster id when its not node level

* add more tests to nodes changed alert

* update default message

* update alert messaging for large shard size

* update default messaging

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-29 13:05:33 -04:00
Ester Martí Vilaseca 46402538d2
[Monitoring] Enable out of the box alerts modal (#101565)
* Remove api call to create alerts

* Add enable alerts modal

* Update modal title

* Add simple alerts dropdown

* change alerts modal design

* refactor alerts modal provider

* Add alerts dropdown

* Show toast after alert creation and add error handling

* Do not show alerts modal if alerts already exist

* Fix stack monitoring test

* Fix more stack monitoring tests and types

* Fix tests after merge

* Attempt to fix stack monitoring tests

* remove console.log

* Change text

* Remove commented comment

* Update docs for stack monitoring alerts

* Fix docs

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-29 17:35:37 +02:00
Yulia Čech 39ba747728
[ILM] Add missing a11y tests (#102887)
* [ILM] Added missing a11y tests

* Fixed ILM functional tests, added after tests cleanup

* Added review suggestions

* Fixed section header renaming

* Fixed section header renaming

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-29 13:01:36 +02:00
ymao1 c05588f077
[Alerting] Enable rule import/export and allow rule types to exclude themselves from export (#102999)
* Removing feature flag changes

* Adding isExportable flag to rule type definition

* Adding isExportable flag to rule type definition

* Adding isExportable flag to rule type definition

* Filtering rule on export by rule type isExportable flag

* Fixing types

* Adding docs

* Fix condition when exportCount is 0

* Unit test for fix condition when exportCount is 0

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-28 20:35:27 -04:00
Aaron Caldwell f28bfa71ad
[Maps] Move edit tools to beta and remove experimental config flags (#103556) 2021-06-28 20:13:12 -04:00
Frank Hassanabad d7d4a14c8d
[Security Solutions][Detection Engine] Implements best effort merging of constant_keyword, runtime fields, aliases, and copy_to fields (#102280)
## Summary

This adds utilities and two strategies for merging using the [fields API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html) and the `_source` document during signal generation. This gives us the ability to support `constant_keyword`, field alias value support, some runtime fields support, and `copy_to` support. Previously we did not copy any of these values and only generated signals based on the `_source` record values. This changes the behavior to allow us to copy some of the mentioned values above.

The folder of `source_fields_merging` contains a `strategy` folder and a `utils` folder which contains both the strategies and the utilities for this implementation. The two strategies are `merge_all_fields_with_source` and `merge_missing_fields_with_source`. The defaulted choice for this PR is we use `merge_missing_fields_with_source` and not the `merge_all_fields_with_source`. The reasoning is that this is much lower risk and lower behavior changes to the signals detection engine.

The main driving force behind this PR is that ECS has introduced `constant_keyword` and that field has the possibility of only showing up in the fields section of a document and not `_source` when index authors do not push the `constant_keyword` into the `_source` section. The secondary driving forces behind this behavioral change is that some users have been expecting their runtime fields, `copy_to` fields, and field alias values of their indexes to be copied into the signals index.

Both strategies of `merge_missing_fields_with_source` and  `merge_all_fields_with_source` are considered Best Effort meaning that both strategies will not always merge as expected when they encounter ambiguous use cases as outlined in the `README.md` text at the top of `source_fields_merging` in detail.

The default used strategy of `merge_missing_fields_with_source` which has the simplest behavior will work in most common use cases. This is simply if the `_source` document is missing a value that is present in the `fields`, and the `fields` value is a primitive concrete value such as a `string` or `number` or `boolean` and the `_source` document does not contain an existing object or ambiguous array, then the value will be merged into `_source` and a new reference is returned. If you call the strategy twice it should be idempotent meaning that the second call will detect a value is now present in `_source` and not re-merge a second time.

* 301 unit tests were added
* Extensive README.md docs are added
* e2e tests are updated to test scenarios and ambiguity and conflicts from previously to support this effort.
* Other e2e tests were updated
* One bug with EQL and fields was found with a workaround implemented. See https://github.com/elastic/elasticsearch/issues/74582
* SearchTypes adjusted to use recursive TypeScript types
* Changed deprecated for `@deprecated` in a few spots
* Removed some `ts-expect-error` in favor of `??` in a few areas
* Added a new handling of epoch strings and tests to `detection_engine/signals/utils.ts` since fields returns `epoch_millis` as a string instead of as a number. 
* Uses lodash safer set to reduce changes of prototype pollution

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

### Risk Matrix


| Risk                      | Probability | Severity | Mitigation/Notes        |
|---------------------------|-------------|----------|-------------------------|
| Prototype pollution | Low | High | Used lodash safer set |
| Users which have existing rules that work, upgrade and now we do not generate signals due to bad merging of fields and _source | Mid | High | We use the safer strategy method, `merge_missing_fields_with_source `, that is lighter weight to start with. We might add a follow up PR which enables a key in Kibana to turn off merging of fields with source. We added extensive unit tests and e2e tests. However, unexpected unknowns and behaviors from runtime fields and fields API such as geo-points looking like nested fields or `epoch_milliseconds` being a string value or runtime fields allowing invalid values were uncovered and tests and utilities around that have been added which makes this PR risky |
| Found a bug with using fields and EQL which caused EQL rules to not run. | Low | High | Implemented workaround for tests to pass and created an Elastic ticket and communicated the bug to EQL developers. |
2021-06-28 18:11:10 -06:00
Bhavya RM bc097856e6
Unskip the reporting screenshots.ts by fixing unable to update UI settings error. (#103184) 2021-06-28 19:33:35 -04:00
Joe Portner 196531502f
Sharing saved objects phase 3.5 (#100424) 2021-06-28 18:06:54 -04:00
Tiago Costa f3a5ff2b98
skip flaky suite (#100968) 2021-06-28 20:56:05 +01:00
Tiago Costa 906b4fcc29
skip flaky suite (#103538) 2021-06-28 20:48:32 +01:00
Alison Goryachev 6b9c66ad24
[ILM] Update API integration test (#103495) 2021-06-28 13:05:37 -04:00
Larry Gregory af38aca3fd
Role Management: improve editing experience for DLS queries (#99977)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-28 12:55:55 -04:00
Aaron Caldwell 4b20ff3bad
[Maps] Add capability to delete features from layer & index (#103145) 2021-06-24 22:25:26 -04:00
Ross Wolf c1ced880bc
[Detections] Adds automatic updating for Prebuilt Security Detection Rules package (#101846)
* Automatically install and update the security_detection_engine package
* Remove security_detection_engine from required Fleet packages
* Update fleet package-registry image
* Add sha256: to the distribution package
* Use distribution from https://beats-ci.elastic.co/job/Ingest-manager/job/release-distribution/152
* Change fleet required packag
* Fix bad merge
* Update rules to 0.13.1 package
* Fix NOTICE.txt
2021-06-24 15:31:25 -06:00
Jonathan Budzenski 45b660172a skip suite failing es promotion. #103364 2021-06-24 16:19:01 -05:00
Josh Dover fbcf405f15
Add telemetry for Elastic Cloud (#102390) 2021-06-24 14:47:38 -04:00
ymao1 7e32f934aa
[Alerting] Using new es client in alerting functional tests (#102349)
* Switching to new es client in alerting tests

* Fixing types

* Updating functional test

* Updating functional test

* Updating functional test

* Fixing error handling

* Fixing types

* Fixing error handling

* Fixing functional tests

* Fixing functional tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-24 12:20:16 -04:00
Patrick Mueller cc6a64514d
[alerting][actions] add task scheduled date and delay to event log - 2 (#103172)
resolves #98634

This adds a new object property to the event log kibana object named
task, with two properties to track the time the task was scheduled to
run, and the delay between when it was supposed to run and when it
actually started. This task property is only added to the appropriate
events.

	task: schema.maybe(
	  schema.object({
	    scheduled: ecsDate(),
	    schedule_delay: ecsNumber(),
	  })
	),

Note that these changes were previously merged to master in https://github.com/elastic/kibana/pull/102252 which had to be reverted - this PR contains the same commits, plus some additional ones to resolve the tests that were broken during the bad merge.
2021-06-24 10:06:01 -04:00
Christos Nasikas b70b34f884
[Cases] Fix push to external service error when connector's mapping does not exists (#102894)
Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-24 16:31:18 +03:00
Dzmitry Lemechko 7a3d61fb67
[load testing] adjust ES heap size (#101906)
* [load testing] increase es heap to 2g

* update default simulation

* [heap size] 4g

* [heap size] 6g

* [load testing] es heap size 8g

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-24 13:45:39 +02:00
Joe Reuter 59d422394a
[Lens] Move empty string handling into field formatter (#102877) 2021-06-24 11:43:33 +02:00
Stratoula Kalafateli 1d2cebafd2
[VisTypePie] Use a different advanced setting for pie charts (#103049)
* Different switch for pie

* Remove unused translations

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-24 12:33:35 +03:00
Robert Oskamp 6a1e4b8d4d
[ML] Functional tests - fix and re-enable close_jobs API tests (#103114)
This PR fixes and re-enables the close_jobs API tests after a backend change.
2021-06-24 10:58:18 +02:00
Liza Katz 01a486000e
[Search Sessions] Split tasks (#99967)
* cancel the previous session

* split to 3 tasks

* fixes

* cancellation

* updated tests

* split out and improve jest tests

* cleanup previous session properly

* don't fail delete and cancel if item was already cleaned up

* test

* test

* ignore resource_not_found_exception when deleting an already cleared \ expired async search

* jest

* update jest

* api int

* fix jest

* testssss

* Code review @dosant

* types

* remove any

* Fix merge

* type

* test

* jest

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-24 10:50:09 +03:00
Joe Reuter aee0585bc5
[Lens] Do not reset columns on incomplete switch before closing flyout (#102876) 2021-06-24 09:35:33 +02:00
Greg Thompson 136d361703
Upgrade EUI to v34.3.0 (#101334)
* eui to v34.1.0

* styled-components types

* src snapshot updates

* x-pack snapshot updates

* eui to v34.2.0

* styled-components todo

* src snapshot updates

* x-pack snapshot updates

* jest test updates

* collapsible_nav

* Hard-code global nav width for bottom bar’s (for now)

* Update to eui v34.3.0

* flyout unmock

* src flyout snapshots

* remove duplicate euioverlaymask

* xpack flyout snapshots

* remove unused import

* sidenavprops

* attr updates

* trial: flyout ownfocus

* remove unused

* graph selector

* jest

* jest

* flyout ownFocus

* saved objects flyout

* console welcome flyout

* timeline flyout

* clean up

* visible

* colorpicker data-test-subj

* selectors

* selector

* ts

* selector

* snapshot

* Fix `use_security_solution_navigation` TS error

* cypress

Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
2021-06-23 15:10:34 -05:00
Steph Milovic 2dc1715a8a
[Security Solution] [Cases] Swimlane Connector for Cases (#100086)
Co-authored-by: Josh <josh.rickard@swimlane.com>
Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-23 22:14:43 +03:00
Tim Sullivan eb7e0fa5f1
Reporting: Check for pending jobs scheduled with ESQueue (#101447)
* Reporting: Check for pending jobs scheduled with ESQueue

* Update x-pack/plugins/reporting/server/lib/tasks/execute_report.ts

Co-authored-by: Vadim Dalecky <streamich@gmail.com>

* update test assertions, use more explicit types

* update comment

* Update x-pack/plugins/reporting/server/lib/store/store.ts

Co-authored-by: Vadim Dalecky <streamich@gmail.com>

* fix field mapping

* Update x-pack/plugins/reporting/server/lib/store/store.ts

Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>

* Report also implements ReportDocumentHead

* the actual ID of the task is prefixed with `task:`

* remove pointless update to the report instance after failing

* comment clarification

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Vadim Dalecky <streamich@gmail.com>
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
2021-06-23 12:06:23 -07:00
John Schulz bb7bff5c96
[Fleet] Add UI and mappings for agent policy unenroll_timeout (#102970)
## Summary

closes https://github.com/elastic/kibana/issues/100617

UI and mappings related to ephemeral agents

- [x] Adds mapping/type/schema definition for the new field in agent policy saved object
- [x] Shows input field labelled `Unenrollment timeout` in agent policy settings that reads/writes to the new field
- [x] Same input in `Advanced options` section of create agent flyout
- [x] `unenroll_timeout` can be set using preconfigured agent policies defined in `kibana.yml`
- [x] `unenroll_timeout` can be populated if the user has a preconfigured policy that _does not_ have this field initially, but then updates their `kibana.yml` later to include it

<details><summary>Screenshot - editing an existing agent policy</summary>

<img width="1251" alt="Screen Shot 2021-06-22 at 1 42 50 PM" src="https://user-images.githubusercontent.com/57655/122974924-d479b800-d360-11eb-8d37-306a6860f140.png">

</details>


<details><summary>Screenshots - adding a new agent policy</summary>
<img width="1258" alt="Screen Shot 2021-06-22 at 1 45 01 PM" src="https://user-images.githubusercontent.com/57655/122975141-0be86480-d361-11eb-9ccb-dde0cc44e438.png">
<img width="1257" alt="Screen Shot 2021-06-22 at 1 45 35 PM" src="https://user-images.githubusercontent.com/57655/122975139-0be86480-d361-11eb-90ae-3541dbbd68e6.png">
<img width="1258" alt="Screen Shot 2021-06-22 at 1 45 44 PM" src="https://user-images.githubusercontent.com/57655/122975138-0b4fce00-d361-11eb-8347-d6f0cb43ab91.png">
<img width="1254" alt="Screen Shot 2021-06-22 at 1 45 56 PM" src="https://user-images.githubusercontent.com/57655/122975136-0b4fce00-d361-11eb-9c51-ec7a9e52ea2b.png">
</details>

<details><summary>Using <code>kibana.dev.yml</code></summary>

<h3>No <code>unenroll_timeout</code></h3>

```yml
xpack.fleet.agentPolicies:
  - name: Preconfigured Policy From Config
    description: From kibana.dev.yml (no timeout given)
    id: 1
    namespace: test
    package_policies:
      - package:
          name: system
        name: System Integration
        inputs:
          - type: system/metrics
            enabled: true
            vars:
              - name: system.hostfs
                value: home/test
            streams:
              - data_stream:
                  dataset: system.core
                enabled: true
                vars:
                  - name: period
                    value: 20s
          - type: winlog
            enabled: false
```

<h4>UI (saved object)</h4>
<img width="1072" alt="Screen Shot 2021-06-23 at 10 28 03 AM" src="https://user-images.githubusercontent.com/57655/123117442-bf0f9700-d40f-11eb-8e8f-685fee3ccb4b.png">

<h4><code>fleet-policies</code>index</h4>
<img width="1690" alt="Screen Shot 2021-06-23 at 10 52 39 AM" src="https://user-images.githubusercontent.com/57655/123119430-883a8080-d411-11eb-990f-4953845a76b5.png">


<h4>Updated <code>kibana.dev.yml</code> to include <code>unenroll_timeout</code></h4>

```yml
xpack.fleet.agentPolicies:
  - name: Preconfigured Policy From Config
    description: From kibana.dev.yml (updated with timeout)
    id: 1
    namespace: test
    unenroll_timeout: 234
    package_policies:
      - package:
          name: system
        name: System Integration
        inputs:
          - type: system/metrics
            enabled: true
            vars:
              - name: system.hostfs
                value: home/test
            streams:
              - data_stream:
                  dataset: system.core
                enabled: true
                vars:
                  - name: period
                    value: 20s
          - type: winlog
            enabled: false
```

<h4>UI (saved object)</h4>
<img width="1073" alt="Screen Shot 2021-06-23 at 10 35 17 AM" src="https://user-images.githubusercontent.com/57655/123117444-bfa82d80-d40f-11eb-94a9-99d4ca4bed2a.png">

<h4><code>fleet-policies</code>index</h4>
<img width="1690" alt="Screen Shot 2021-06-23 at 10 35 41 AM" src="https://user-images.githubusercontent.com/57655/123117446-bfa82d80-d40f-11eb-9563-1add80f43f0e.png">

</details>

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