Go to file
Ryland Herrick 45df5fdf42
[SIEM] Migrate backend to use New Platform services (#51144)
* Mark incoming plugin members as readonly

These cannot and should not be modifiable.

* Use env var instead of EnvironmentMode

* There doesn't appear to be an EnvMode in the new platform
* We're only using envMode to check whether we're in production
* We're already using process.env.NODE_ENV elsewhere

We can revisit this, but for now I'm simplifying things under this
assumption.

* Pass our setup context to the compose function

We're going to retrieve our router instance from this, for now.

* Remove unused static files route

I spent a few minutes trying to do this in the new platform, only to
realize that this was cargo culted from another plugin's structure and
never used.

* WIP: convert main GraphQL endpoints to New Platform

Splits the existing dual-method route into separate GET/POST
routes, while converting it to the NP routing syntax

TODO:
* Full route schema declarations
* Address context being moved off of the response object and into its
own object; callWithRequest is currently broken for this reason.

* Remove unnecesary Request type

While the defaultIndex patterns can be retrieved on the request itself,
that requires this special case of our FrameworkRequest.

In my smoke testing, the incoming `indices` argument was never different from
the one present on the request payload. Xavier had mentioned that these
might be redundant and a relic of some quick prototyping, so I'm going
to simplify this logic and delete that type under this assumption.

* Retrieve Elasticsearch client from RequestHandlerContext

In order to minimize the amount of noise on this refactor, I'm adding
the RequestHandlerContext to the existing FrameworkRequest object that
we already pass around.

This also removes some adapter methods that were cribbed from infra but
have since become unused. There are likely more.

* Use uiSettings client from RequestHandlerContext

Pulls from the new platform instead of from request.server.

* Remove unused properties from RequestFacade

One of these was obviated by the refactor to NP routing; the other may
never have been necessary.

* Remove unused interface

This is a relic that is no longer used in the codebase.

* Make error response code dynamic

* Handle GraphQL errors

Refactors to use new platform's responses instead of Boom.

Unless we intentionally do not want isGraphQLError error headers, I saw no
reason for the latter two branches of this method (and merged them).

* Fix graphiQL route

We needed to loosen the restriction on our main POST graphQL route, as
the requests coming from graphiQL do not match our normal format.

* Clean up logging

* Remove unused var injection functionality

I could not find a case where we were using these vars within the siem
app.

* Fix typo on config fetching

* Migrate to NP IndexPatterns service

* Removes unused extra parameter on callWithRequest
  * I think this was a relic from the infra code
* Clean up typings of callWithRequest
  * GenericParams is, ironically, not generic enough to handle all ES
  client calls. Instead we type it as Record<string, any> but ensure
  that our function adheres to the APICaller interface.

* Use savedObjects client in request context

These resolvers already receive a request containing the NP context, so
we can retrieve our client directly from that, now.

* Rename dependencies -> plugins to match kibana.json

* Remove unnecessary type annotation

The type of callCluster is already checked due to being passed to the
IndexPatternsFetcher constructor.

* Add siem plugin to new platform

For now this just generates a config observable with some defaults;
everything still lives in the legacy plugin.

* WIP: flattening out plugin initialization

Rather than pass our legacy API around everywhere, let's be explicit
about who needs what, and start flattening things out so that we can
move the legacy-independent stuff over.

* Pass our plugin context to initServerWithKibana

We can get the NP equivalent of `pkg.version` from
context.env.packageInfo.version, so let's do that and remove a usage of
config().

* Simplify siem configuration

As far as I can tell, the only siem config that we're using is
`xpack.siem.enabled`. The `query` was a holdover from infra, and if
we're using the `sources` queries at all, it's only with the default
values. Since our config is not typed, trying to add `sources` config
only results in runtime errors.

This removes the KibanaConfigurationAdapter entirely, and instead passes
what is effectively { sources: {} } to the SourcesConfigurationAdapter.

* Run all legacy-free setup through our plugin

Once this is vetted, we should be able to move the entire tree under the
plugin into the new platform plugin. We can inline the compose and
init_server calls into the plugin once things are vetted and stable; for
now leaving them there cuts down on the diff.

* Temporarily ignore our unused config declaration

* Fix detection engine route tests

While we're passing a properly bound route function in the app, the
tests' interfaces needed to be updated. Adds a helper method for
retrieving a bound route function from a Server object.

* Add some rudimentary schema validation to our graphQL endpoints

* Remove defunct server.config fn

The last remaining usage of this config was removed in #51985.

* Group our dev endpoints together

The graphiQL endpoint is the only thing that currently uses the GET
endpoint; everything else that talks to graphQL uses POST. For that
reason, I'm putting them in the same scope (along with annotating here)
to make that a bit clearer.

* Determine environment from plugin context

The kibana platform did and does provide this interface to check with
environment we're running in.

* Migrate xpack_main to NP features service

* Fix some issues missed in the previous merge

DE added some dependencies on both the server and request objects. Most
have NP equivalents and can be converted, but for now let's just add
them back to the Facades and convert in another PR.

Also changes one function to pull plugins from the server object, rather
than the server object living on the request (as this is how similar
functions are structured right now).

* Fix type resulting from bad merge resolution

* Fix type error due to incorrect usage of Hapi.Request

Pull elasticsearch service off our legacy server object, rather than
indirectly off the request object. Still legacy, but it's one less step
for later.
2019-12-09 15:17:29 -06:00
.ci ci(jenkins): enable APM UI e2e tests (#48109) 2019-12-05 13:55:43 +00:00
.github add codeowners for legacy server folder (#52158) 2019-12-06 08:23:48 +01:00
bin Update node options Initialization on our scripts (#40302) 2019-08-15 16:09:22 +01:00
common/graphql [Uptime] Implement EuiSuperDatePicker (#28217) 2019-01-18 13:44:58 -05:00
config Instrument Kibana with Elastic APM (#43548) 2019-12-04 15:21:07 +01:00
data [folder structure] plugins/.data -> data 2016-07-05 14:06:16 -05:00
docs Expose SavedObjectsStart from AppMountContext (#52059) 2019-12-09 12:37:54 +01:00
licenses Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
packages Upgrade typescript-eslint to 2.10.0 (#52528) 2019-12-09 19:49:15 +01:00
rfcs Update deprecated React.SFC and React.StatelessComponent types (#50852) 2019-11-21 20:53:54 +01:00
scripts Instrument Kibana with Elastic APM (#43548) 2019-12-04 15:21:07 +01:00
src Cancel discarded KQL value suggestion requests (#51411) 2019-12-09 12:43:52 -07:00
style_guides Updating accessibility guide and contributing readmes (#52038) 2019-12-04 19:11:16 -06:00
tasks chore(NA): fix licenses task on grunt test task (#51444) 2019-12-03 16:09:47 -07:00
test Support nested fields in existing filter types (#49537) 2019-12-09 14:16:15 -05:00
typings [State Management] Typescripify, jestify, simplify state_hashing and state_storage (#51835) 2019-12-04 12:36:03 +01:00
utilities Clean up uses of deprecated API's in node core (#51431) 2019-12-04 16:17:19 +01:00
vars [ci/pipeline/reportFailures] when aborted, run with --no-github-update (#52355) 2019-12-06 12:27:06 -07:00
webpackShims Add lru-cache shim (#49014) 2019-10-23 12:56:00 -05:00
x-pack [SIEM] Migrate backend to use New Platform services (#51144) 2019-12-09 15:17:29 -06:00
.backportrc.json Add 7.5 to .backportrc.json 2019-10-16 21:20:14 +02:00
.browserslistrc [autoprefixer] upgrade to 9.6.1, unify browserslist handling (#41038) 2019-07-15 09:33:33 -07:00
.editorconfig [editorconfig] disable insert_final_newline for package.json 2019-04-18 09:44:17 -07:00
.eslintignore Move @kbn/es-query into data plugin (#51014) 2019-11-26 13:28:04 -07:00
.eslintrc.js fix linting errors in graph (#50907) 2019-12-03 15:44:37 +01:00
.gitattributes [canvas] Color fixes + Storybook 5 (#34075) 2019-04-02 11:21:51 -05:00
.gitignore Instrument Kibana with Elastic APM (#43548) 2019-12-04 15:21:07 +01:00
.i18nrc.json ui/management -> new platform (#45747) 2019-12-09 11:56:51 -06:00
.node-version Bump node to 10.15.2 (#32200) 2019-02-28 10:48:42 -06:00
.nvmrc Bump node to 10.15.2 (#32200) 2019-02-28 10:48:42 -06:00
.prettierrc Increase prettier line width to 100 (#20535) 2018-07-09 22:50:37 +02:00
.sass-lint.yml Move query utils ⇒ NP (#49636) 2019-11-14 13:06:36 +02:00
.yarnrc [kbn-pm] Use yarn workspaces for dependencies (#24095) 2018-11-12 12:38:11 -06:00
CONTRIBUTING.md Add example apm.dev.js config file to CONTRIBUTING.md (#52206) 2019-12-05 14:45:44 +01:00
FAQ.md propose language changes (#10709) 2017-03-05 12:10:32 -05:00
github_checks_reporter.json implementing github checks - second attempt (#35757) 2019-05-01 16:02:33 -05:00
Gruntfile.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
Jenkinsfile Add PR comments to pipeline (#51504) 2019-12-03 18:06:30 -05:00
kibana.d.ts Update eslint related packages (#48513) 2019-10-21 16:32:31 -07:00
LICENSE.txt Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
NOTICE.txt standardize notice-comment usage (#48677) 2019-10-21 11:54:45 -07:00
package.json Upgrade typescript-eslint to 2.10.0 (#52528) 2019-12-09 19:49:15 +01:00
preinstall_check.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
README.md chore: point issue links to choose (#49616) 2019-10-29 15:54:27 +01:00
renovate.json5 Swap renovate codeowners with assignee configuration (#48987) 2019-11-25 09:38:49 -06:00
STYLEGUIDE.md Upgrade to TypeScript 3.7.2 (#47188) 2019-11-15 10:33:29 +01:00
tsconfig.browser.json [typescript] continue to use the default config in development (#21966) 2018-08-14 15:27:07 -07:00
tsconfig.json Es ui shared updates (#46570) 2019-09-26 17:06:33 +02:00
tsconfig.types.json [Core] Move Saved objects files to core (#38771) 2019-06-18 13:10:23 +02:00
TYPESCRIPT.md Update deprecated React.SFC and React.StatelessComponent types (#50852) 2019-11-21 20:53:54 +01:00
yarn.lock Upgrade typescript-eslint to 2.10.0 (#52528) 2019-12-09 19:49:15 +01:00

Kibana

Kibana is your window into the Elastic Stack. Specifically, it's a browser-based analytics and search dashboard for Elasticsearch.

Getting Started

If you just want to try Kibana out, check out the Elastic Stack Getting Started Page to give it a whirl.

If you're interested in diving a bit deeper and getting a taste of Kibana's capabilities, head over to the Kibana Getting Started Page.

Using a Kibana Release

If you want to use a Kibana release in production, give it a test run, or just play around:

Building and Running Kibana, and/or Contributing Code

You might want to build Kibana locally to contribute some code, test out the latest features, or try out an open PR:

Documentation

Visit Elastic.co for the full Kibana documentation.

For information about building the documentation, see the README in elastic/docs.

Version Compatibility with Elasticsearch

Ideally, you should be running Elasticsearch and Kibana with matching version numbers. If your Elasticsearch has an older version number or a newer major number than Kibana, then Kibana will fail to run. If Elasticsearch has a newer minor or patch number than Kibana, then the Kibana Server will log a warning.

Note: The version numbers below are only examples, meant to illustrate the relationships between different types of version numbers.

Situation Example Kibana version Example ES version Outcome
Versions are the same. 5.1.2 5.1.2 💚 OK
ES patch number is newer. 5.1.2 5.1.5 ⚠️ Logged warning
ES minor number is newer. 5.1.2 5.5.0 ⚠️ Logged warning
ES major number is newer. 5.1.2 6.0.0 🚫 Fatal error
ES patch number is older. 5.1.2 5.1.0 ⚠️ Logged warning
ES minor number is older. 5.1.2 5.0.0 🚫 Fatal error
ES major number is older. 5.1.2 4.0.0 🚫 Fatal error

Questions? Problems? Suggestions?

  • If you've found a bug or want to request a feature, please create a GitHub Issue. Please check to make sure someone else hasn't already created an issue for the same topic.
  • Need help using Kibana? Ask away on our Kibana Discuss Forum and a fellow community member or Elastic engineer will be glad to help you out.