Commit graph

27120 commits

Author SHA1 Message Date
Mikhail Shustov 1a3c2e3ba2
Expose package info to NP plugins (#48101) (#48215)
* provide packageInfo to server plugins

* provide env to kbn server

* provide env to client plugins

* update server mocks and tests

* update client mocks and tests

* add integration test

* regen docs

* remove weird file

* export types for the client from special folder

* env should not affect test ourcome
2019-10-15 15:42:22 +02:00
Dario Gieselaar cf7f2aa8c5
[7.x] [APM] Replace ui/kfetch with core.http (#47635) (#48211)
* [APM] Replace ui/kfetch with core.http

Closes #46548.

* Remove kfetch mocks in tests

* Expose HttpFetchError from src/core/public/index

* Make HttpFetchError public

* Simplify tests for ServiceOverview
2019-10-15 15:25:06 +02:00
Catherine Liu 1a3c8bf814
[7.x] [Canvas][i18n] Function Form component (#48073) (#48212)
* Extracted i18n strings from FunctionForm component

* Fixed duplicate i18n ids
2019-10-15 15:17:00 +02:00
Jean-Louis Leysens f42bd52db6
Added track_total_hits autocomplete (#48146) (#48204) 2019-10-15 15:14:37 +02:00
Søren Louv-Jansen a1b1be053f
log stacktrace comes from _.error and not _error.exceptio[0] (#48185) (#48205) 2019-10-15 13:07:47 +02:00
Ben Skelker 79fe5a3abb
[SIEM] Add button with link to license management in ML popup (#47841) (#48207)
* Add button with link to license management in ML popup

* Corrections to button styling

* Updated button icon

* Update snapshots

* Correcting json translation files

* Fix zh_CN json file

* And now fixing the translation file properly
2019-10-15 13:48:12 +03:00
Mikhail Shustov 53aab78577
Document custom validation for http request (#47699) (#48203)
* document custom validation for http request

* generate docs
2019-10-15 12:19:55 +02:00
James Gowdy 3cf395ef0e
[ML] Adding datafeed validation to advanced wizard (#48050) (#48202)
* [ML] Adding datafeed validation to advanced wizard

* shared invalid time format message

* updating translations

* adding time format validation function
2019-10-15 11:05:17 +01:00
Ben Skelker aacc2eda63
[SIEM] Update SIEM ML license requirements popup text (#47445) (#48198)
* Update SIEM ML license requirements text

* Updates ML license popup with link to cloud

* Added updated translation json files
2019-10-15 12:32:34 +03:00
Mikhail Shustov df1152cfda
fix config reload for legacy plugin. failed due to ES fields validation (#48080) (#48200) 2019-10-15 10:57:17 +02:00
Christiane (Tina) Heiligers 44bce46484 Prepare for TS 3.7 conversion (#47794) (#48163) 2019-10-15 09:03:18 +02:00
CJ Cenizal f2e91f6c3a
Add API Keys app to Management > Security. (#45740) (#48175)
* Add API Keys app to Management > Security.
- For admins, list all API Keys created by the user: Name, Date Created, Expiration Date, Status, User, and Realm.
- For non-admins, list own API keys: Name, Date Created, Expiration Date, and Status.
- Surface admin status above table.
- Ability to search by Name and Revoke (invalidate) API keys, and filter by User and Realm.
- Surface feedback when API keys are disabled on Elasticsearch or when user lacks required permissions.
* Add `SectionLoading` component to `es_ui_shared` plugin.
2019-10-14 20:17:49 -07:00
Justin Kambic bad9c8b762
[Uptime] Add Donut chart (#47176) (#48037)
* Add donut chart.

* Merge donut chart with snapshot histogram panel.

* Update broken test snapshot.

* Undo removal of gray color from histogram chart.

* Use proper color values for donut chart and legend.

* Move donut chart to charts directory.

* Add snapshot tests for new chart components.

* Merge donut chart with snapshot histogram panel.

* Revert d3 version.

* Revert yarn.lock.

* Revert code to be compatible with older d3 version.

* Delete duplicated files.

* Clean up code.

* Improve const names.

* Update outdated snapshots.

* Fix broken type.

* Simplify function, add comment.

* Remove unused translations.

* Fix broken chart component.

* Implement designer feedback.

* Fix regression.

* Implement additional designer feedback.

* Fix issue that caused residual paths to remain on subsequent paints of donut chart.

* Update obsolete test snapshots.

* Revert yarn.lock.

* Rename repurposed translation.

* Delete obsolete translations.

* Update busted test snapshot.
2019-10-14 22:09:13 -04:00
Tiago Costa 9c11ab380b
chore(NA): set back older terser defaults on new major version (#48140) (#48186) 2019-10-15 02:41:47 +01:00
CJ Cenizal aac9ae3c53
Add head http method to request type. (#46927) (#48177) 2019-10-14 17:27:37 -07:00
Andrew Cholakian c77bf2b5c2
[Uptime] Aggregate by IP in pagination (#47598) (#48172)
Fixes issue where at most 2 IPs could be shown in MonitorList component. This adds an aggregation by monitor.ip to fix this.
2019-10-14 18:36:13 -05:00
Joel Griffith 254d9c66bb
Make sure all URLs are relative on intake and execute (#46528) (#48161)
* Fail file-protocol requests and bogon IP

* Revert "Fail file-protocol requests and bogon IP"

This reverts commit 8a1ff56179.

* Ensuring all URLs from PDF and PNG reports are relative

* Missing dep, saw it in a prior yarn.lock

* Tighenting our URL checks

* More edgecases that can be triggered with a window.goto type behavior

* Javascript URLs

* Tightening implementation

* New networkPolicy that allows for setting allow/deny list for chromium requests

* Fixing tests, always fail file:// URLs

* Never allow file responses

* Make sure we test other protocols in deny list

* Don't allow `file:` protocols in the allow-list

* Expanding upon network policy to match ufw-style patterns

* Applying network policies to outbound and inbound requests

* Fixing gateway logic on network-policy

* My network-policy opus

* Moving to more explicit ufw format

* Updating snapshots

* Default reject requests when enabled and no rule matches
2019-10-14 16:29:49 -07:00
Steph Milovic 7b75332edb
[SIEM] Source/Destination Ip Table on Ip Details (#47608) (#48170) 2019-10-14 16:17:57 -07:00
Nathan Reese 4b7bb4a16e
[Maps] clean features in locked tooltip after re-fetch (#48016) (#48164)
* [Maps] clean features in locked tooltip after re-fetch

* fetch geometry from FEATURE_ID_PROPERTY_NAME instead of _id

* set FEATURE_ID_PROPERTY_NAME for pew pew source

* do not update tooltip state if no features were removed

* set FEATURE_ID_PROPERTY_NAME for EMS_file source and kibana_regionmap source

* avoid adding lodash to map actions

* use if else instead of early return
2019-10-14 16:29:26 -06:00
Frank Hassanabad 42ea32a13f
[SIEM][Detection Engine] Adds Read, Update, Delete API endpoints (#47765) (#48162)
## Summary

* Adds a Read, Update, Delete, and Find API endpoints.
* Adds several scripts to exercise the endpoints as well as improves the helper scripts
* Fixes a bad assumption with the way alert params works with `null`
* Fixes a bug where I was using an array instead of a number of `max_signals` 
* Fixes a bug with the log level since it upgraded recently and requires a log level
 

IMPORTANT NOTE:
---
This still uses auto-generated GUID's and not the alert id so there are not stable id's just yet. However, either we will add that capability through alert params or the alerting team will add the capability to do a POST of the {id} into the create endpoints.

Testing:
---
Follow the `README.md` for initial setup of our temporary environment variables. Use the scripts and post a signal after a hard reset like so:

```ts
./hard_reset.sh
./post_signal.sh
``` 

Then run the following scripts to test each piece:

```sh
# Creates a new signal
./post_signal.sh
{
    "id": "908a6af1-ac63-4d52-a856-fc635a00db0f",
    "alertTypeId": "siem.signals",
    "interval": "5m",
    "actions": [
        {
            "group": "default",
            "params": {
                "message": "SIEM Alert Fired"
            },
            "id": "7edd7e98-9286-4fdb-a5c5-16de776bc7c7"
        }
    ],
    "alertTypeParams": {},
    "enabled": true,
    "throttle": null,
    "createdBy": "elastic",
    "updatedBy": "elastic",
    "apiKeyOwner": "elastic",
    "scheduledTaskId": "4f401ca0-e402-11e9-94ed-051d758a6c79"
}

# Read a signal that is from the result 
./read_signal.sh 908a6af1-ac63-4d52-a856-fc635a00db0f

# Edit the file `vim signals/temp_update_1.json` (manually) and add the ID into 
# it like so since we don't have stable alert ID's just yet
{
  "id": "908a6af1-ac63-4d52-a856-fc635a00db0f",
  "description": "Only watch winlogbeat users",
  "index": ["winlogbeat-*"],
  "interval": "9m",
  "name": "Just watch other winlogbeat users",
  "severity": 500,
  "enabled": false,
  "type": "filter",
  "from": "now-5d",
  "to": "now-1d",
  "kql": "user.name: something_else"
}

# Then update it
./update_signal.sh

# Then run a find to see all signals
./find_signals.sh

# Delete the signal
./delete_signal.sh 908a6af1-ac63-4d52-a856-fc635a00db0f
```

Take a look at the arguments and play around with removing fields from the update document as well as using different features of the API to see if something is broken for the initial roll out.

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] 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/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

~~- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~
2019-10-14 16:29:01 -06:00
Poff Poffenberger c3e72354e9
Update log example data canvas link to correct workpad (#47979) (#48145) 2019-10-14 16:11:20 -05:00
Poff Poffenberger 3ccb482480
[Canvas] i18n for Link, Error, and RenderWithFn components (#47900) (#48147)
* i18n error component

* i18n for link component

* Updating error component i18n key

* i18n for RenderWithFn
2019-10-14 16:11:13 -05:00
Justin Kambic 023c8f6b8b
Add test to ensure that URL params are dropped from URL search if the new value is empty. (#47905) (#47963) 2019-10-14 16:51:36 -04:00
Dima Arnautov 591f06bb05
[ML] Render Custom URL as textarea on focus (#48077) (#48148) 2019-10-14 22:49:43 +02:00
Nathan L Smith 073c864abe
[7.x] Do not use the idx babel plugin in the test environment… (#48118)
When running Jest with `--coverage`, modules using idx fail with the error shown in facebookincubator/idx#19.

Change the babel configuration so that is `NODE_ENV=test`, the idx plugin is not loaded.
2019-10-14 15:33:08 -05:00
Alison Goryachev 8a5ad6a18d
[SR] address slm retention copy feedback (#47625) (#48142) 2019-10-14 15:56:59 -04:00
Chris Roberson f3991b9e52
[7.x] [Monitoring] New platform migration - Server shim (#46507) (#48014)
* [Monitoring] New platform migration - Server shim (#46507)

* WIP

* More NP refactoring

* Hook up infra postInit logic

* Fix broken tests

* Cleanup

* Add missing config for 7.x
2019-10-14 15:45:20 -04:00
Kaarina Tungseth 82c3d6af15
[DOCS] Improvements to the upgrade docs (#48126) (#48151) 2019-10-14 14:42:29 -05:00
Joe Reuter d5cfc3d82a
Timelion: improve error handling (#47958) (#48130) 2019-10-14 21:31:16 +02:00
Joe Reuter 9b1313bd0a
make sure filters are not re-synced accidentally (#47937) (#48129) 2019-10-14 21:31:05 +02:00
Joe Reuter fb83eefab7
Saved object finder: Include freely specifable fields in request (#47321) (#48128) 2019-10-14 21:30:57 +02:00
Joe Reuter 726b7e45c6
fix wording in field editor (#48068) (#48127) 2019-10-14 21:30:48 +02:00
Justin Kambic 2a795620c8
[Uptime] Improve UI tests and platform (#46269) (#47766)
* Remove depdency on legacy interface.

* Remove custom interface, use common breadcrumb type.

* Add HTML template for app react entry point.

* Update app props.

* Add constant for react app entry point.

* Remove dependency on legacy capabilities provider.

* Delete legacy kibana framework adapter.

* Add New Platform adapter, reference in startup code.

* Remove dependency on legacy capabilities function.

* Delete reference to obsolete interface.

* Fix busted types in new adapter.

* Add new plugin class, delete old bootstrap code.

* Update routing/functional tests.

* Provide default for potentially-undefined value.

* run x-pack-ciGroup6 40 times

* Reinsert firefox skip tag.

* Update functional tests to work with newly-merged fixtures.

* Revert "run x-pack-ciGroup6 40 times"

This reverts commit ac3b1e49fa.
2019-10-14 15:21:32 -04:00
James Gowdy 5598cd7520
[ML] Adding all ML detector functions to advanced wizard (#47972) (#48134)
* [ML] Adding all ML detector functions to advanced wizard

* updating stubbed endpoint responses

* updating tests

* changes based on review

* small refactor
2019-10-14 20:18:24 +01:00
James Gowdy 621fa37c96
[ML] Adding datafeed preview to advanced wizard (#47993) (#48125)
* [ML] Adding datafeed preview to advanced wizard

* changes based on review

* adding flyout to other steps
2019-10-14 20:18:15 +01:00
Devin W. Hurley bf540c64a9
[SIEM] [Detection Engine] Replacing of Reindex in Signals API with Scroll and Bulk Indexing (#47386) (#48137)
* working commit with no re-index.. very messy working draft

* Add flag for using GET/PUT instead of reindex, remove painless script from GET/PUT, clean up code

* unset alerting and actions features since feature flags are not present

* fix leftover merge conflicts from rebase

* Defaults to scroll and bulk index combination instead of reindex, updates docs, updates erroneous log.info to log.error

* Refactors bulkIndex method to remove useage of let and increase readability

* Replaces env variable, remove scroll and bulk index logic from signals_alert_type.ts and updates logger.info -> logger.error in catch clause

* add ternary for scroll lock parameter

* minor cleanup from merge with master

* removes class definition and exports separate functions for scroll and bulk functionality, replaces logger.info with a logger.error, adds another signal for testing zero documents upon initial search query
2019-10-14 15:17:14 -04:00
Matthew Kime a635fabc3d
Field list - from indexed array to arrays and maps (#47921) (#48138)
* make fieldList extend array
2019-10-14 14:11:21 -05:00
Corey Robertson 7805d1235e [Canvas] Translate Element Types modal (#47875) (#48112)
* Tranlate Name label

* Translate Element Types modal

* Fix i18n check
2019-10-14 14:06:46 -05:00
Corey Robertson 177033e532 [Canvas] Sets up New Platform Shim for Server (#45929) (#48111)
* Sets up New Platform Shim for Server

* Addresses PR Feedback

* Fix type check
2019-10-14 13:58:17 -05:00
Robert Oskamp 1808dbe42c
[ML] Add test to delete job (#47677) (#48107)
This PR adds a test to delete a anomaly detection job.
2019-10-14 20:22:38 +02:00
Chris Davies 1e56eeda01
[Lens] Sync field existence data when date range or index patterns change (#46988) (#48133) 2019-10-14 14:21:17 -04:00
Shahzad 9dd2b8c740 [Uptime] Update pings chart colors (#46780) (#47952) 2019-10-14 11:08:02 -07:00
Chris Roberson bceea57fbb
[Monitoring] Fix time filter woes (#47486) (#48007)
* Fix time filter woes and add tests

* Fix up tests and fix loading states for non ssp tables

* Only add onChange if searching is enabled

* Replace missing function
2019-10-14 14:06:55 -04:00
sainthkh 88a4db04b0 Adding "setting up prettier" in CONTRIBUTING.md (#46310)
Co-Authored-By: Jonathan Budzenski <jon@budzenski.me>
2019-10-14 11:02:44 -07:00
dave.snider@gmail.com df3cdc138e
Small touch ups to lens empty state and field previews (#48044) (#48063)
* small touch ups for lens

* feedback
2019-10-14 10:50:02 -07:00
Andrew Cholakian b2b4212a29 [Uptime] Query Overhaul + Pagination (#42933) (#48120)
Summary

Adds pagination to the Uptime app's monitor overview page. Also cleans up/removes a lot of unused code that laid the foundation for the states index approach we opted not to take.

This PR is somewhat complex due to our need to use composite aggregations with searchAfter style pagination.
Understanding our new query approach
How the schema works

At its simplest, we run a single heartbeat from a single location checking a single endpoint with a single IP.In this case, everytime we run a check we create a new document.

------ time --------------->
[D] [D] [D] [D] [D] [D] [D]

We can also check from multiple geo locations

Location | ---------- time ----------->
 US-E    ` [D] [D] [D] [D] [D] [D] [D]
 US-W    ` [D] [D] [D] [D] [D] [D] [D]

We can also check multiple ip addresses per check if there are multiple DNS entries. If the endpoint we're checking has 3 DNS entries we will create 3 documents per check. The final document has an extra summary field with two integer values: summary.up and summary.down summarizing how many documents were up vs down across all three documents in the check. All documents also contain a monitor.check_group UUID string field that has a shared value across all three documents.

Note the partially written group at the end
--------------- time --------------------->
Docs   | [D] [D] [S] [D] [D] [S] [D]
Groups | |--UUID1--| |--UUID2--| |-UUID3-

Putting it all together, we can have multiple geo locations with multiple IPs checked within each location.

Location | ------------------time-------------------------->
         `
US-W     ` [D] [D] [S] [D] [D] [S] [D]
         ` |--UUID1--| |--UUID2--| |-UUID3-
         `
US-E     ` [D] [D] [S]   [D] [D] [S] [D] [D] [S]
         ` |--UUIDA--|   |--UUIDB--| |--UUIDC--|

The Query
Goals

Logically, what we want to do when searching is to:

    Match the most recent complete check group from each location and return all documents from that check group.
    For any specific fields (say error.message or monitor.ip) consider the monitor matched if any documents in any location have that value.
    For status filtering consider the monitor up if all documents within the latest check groups for each location are up.

Additional properties we'd like this query to have:

    Be paginatable
    Be fast
    Be in a consistent order (required for pagination)

At a High Level

There are three phases, described in detail below, but the TL;DR is:

    queryPotentialMatches() Find monitor.id,mostrecent(check_group) tuples that match the query and all filters except status. We eagerly fetch 500 results here knowing that we may discard some of these results in the next phase.
    refinePotentialMatches() Perform an additional query that pulls in all the most recent check summaries from all locations for the monitor IDs from the last phase. We compare the matched check groups from the last phase to see if what matched previously was out of date. We can now apply the status filter as well.
    enrich At this point we already have the matching monitor IDs and their status, but we haven't brought in most of their fields. Here we re-query to get all docs from the matching monitor IDs most recent checks, then format them for return via API.

queryPotentialMatches()

This query returns via a composite agg all monitor IDs matching all query. It also returns the latest matching monitor.check group of all monitor IDs with the correct monitor.status value. Note that the returned monitor.check_group value will only be the most recent value matching the query terms. It may be an old check.

So, the output of the check is all monitor.id values that have ever had a document that matched the query. However, these matches may be old.

TODO: The PR as it stands doesn't work exactly this way, I added in an optimization for status filtering that actually is incorrect. We can exclude matches that are down if we're looking for things that are up, but nothing more than that.
refinePotentialMatches()

In this phase we take the monitor.id values from the preceeding phase and query for all the latest check groups per geo-location for each via a terms query plus terms aggs, using a top hit to get the most recent (top hit size 1 is more efficient than a terms agg on a high cardinality string field sorted , I believe due to global ordinals). Then, in Javascript, we can further exclude monitors based on the monitor.status fiter. If the status filter is up we exclude any monitors that have any down checks using the summary fields. By using the summary fields we additionally ensure that we only include the most recent complete check groups, instead of partial ones.

We then combine the output of the preceding phase, kicking out results from the initial phase that didn't have their latest complete check groups match.
Enrichment

We already have the correct monitor IDs, but we don't have all the data from all matching documents inside the check groups. We only got the summary documents (and only returned the monitor.id and check group) in the preceding phase. In this straightforward phase we get all the documents for the latest check groups for each monitor and combine them into the final response. Additionally adding histogram data via an auxiliary query.
Pagination

The query phases described above omit discussion of how pagination works. We don't want to retrieve all matching monitor.ids, if a user has 30k monitors that can be expensive. Our default page only shows 10 in this patch. By limiting results we increase speed. Additionally, by using "after" style pagination as composite aggregations use, each page load is as fast as the first, we don't have the performance issues traditional page number style pagination has as you go deep into the result set.

Internally the code has an Iterator style paginator object covering all phases except the final enrichment phase that has the following functions:

    next() Gets the next monitor matching the query advances the internal cursor.
    peek() Gets the next monitor matching the query, does not advance the internal cursor.
    current() Gets the monitor at the current cursor
    paginationAfterCurrent() Checks via peek to see if there is more data, and if so returns pagination data to be sent on the next request to get the next page. This powers the 'next' button.
    paginationBeforeCurrent() Same as preceeding, but gets the pagination info for the page before the current item. TODO add this method instead of the current hacky way with reverse()

Internally we overfetch for the initial filter query to provide a buffer for the paginator; we don't want a query per next() invocation. That's currently set to 500 items at the moment, which is pretty snappy.

Fixes elastic/uptime#63
Alternative approaches considered

    Using data frames: We rejected this approach for two reasons: 1.) It's one more thing that a user can accidentally break 2.) Worry over the cost of constantly re-indexing every document with low latency. We'd need to reindex everything once every 5-10s to prevent excessive lag.
    Kibana Background jobs and a high water mark. This would involve having a background job in Kibana that would compute the most recent documents for each monitor at a given time and then mark them with a high water mark using an update by query. This has the same issues as the data frames in terms of excessive doc writes and scalability. However, there's less to break in a sense in that there's no extra indices. OTOH, users have configure kibana to let it write to uptime indices.
2019-10-14 13:33:32 -04:00
Lukas Olson cf414a8a1e Default to _search instead of _msearch in courier (#45174)
* Default to _search instead of _msearch in courier

* Fix callClient tests

* Revert accidental commit

* Fix proxy to properly return response from ES
2019-10-14 09:21:16 -07:00
Poff Poffenberger bb5adc5361
[Canvas] i18n for Expression Input editor (#47767) (#48040)
* i18n for expression input reference component

* wip

* Better i18n for expression input

* Add bold markdown token into the constants
2019-10-14 11:19:45 -05:00
Alexey Antonov cb6f8ec429
Prepare index_patterns/index_pattern.ts for move - remove ui/notify (#47969) (#48084) 2019-10-14 19:06:08 +03:00
Dmitry Lemeshko 684d823e67
Fix several recently failed functional tests (#47976) (#48103)
* small tweaks to make tests more stable

* fix empty list check, update more tests

* fix
2019-10-14 17:19:18 +02:00