kibana/x-pack/plugins/ml
Craig Chamberlain 313d85e985
[ML] Adds security_linux and security_windows Modules (#85065)
* initial commit

refactored multi-index, multi-pipeline jobs for 7.11. These are new modules that will live alongside the existing jobs.

* Update ml_modules.tsx

added new module names to the list

* Update get_module.ts

added new module names

* Linter fixes

* Order matters

* manifest fixes

added colon char to the module name and shortened the description

* additon to description

after talking with the security team today, adding this suggested text to the beginning of the description so it will tend to be visible to the user:
"This is a new refactored job which works on ECS compatible events across multiple indices."

* Adjust module recognizer test for auditbeat dataset

* influencers

changes to the metadata jobs to make influencers identical to the originals

* change for security app

changes to two datafeeds needed for logic in the Security app - added the suffix "_ecs" to two ids.

Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
Co-authored-by: Robert Oskamp <robert.oskamp@elastic.co>
2020-12-10 14:02:41 -05:00
..
__mocks__
common [ML] Improve messaging and support for datafeed using aggregated and scripted fields (#84594) 2020-12-10 11:35:51 -06:00
public [ML] Improve messaging and support for datafeed using aggregated and scripted fields (#84594) 2020-12-10 11:35:51 -06:00
server [ML] Adds security_linux and security_windows Modules (#85065) 2020-12-10 14:02:41 -05:00
.gitignore
jest.config.js Jest multi-project configuration (#77894) 2020-12-02 11:42:23 -08:00
kibana.json [ML] Space management UI (#83320) 2020-11-19 15:26:01 +00:00
package.json [ML] Update apidoc config with the Trained models endpoints (#83274) 2020-11-12 17:51:42 +01:00
readme.md [ML] Add basic license test run details to ML+Transform READMEs (#83259) 2020-11-16 10:25:42 +01:00
shared_imports.ts

Documentation for ML UI developers

This plugin provides access to the machine learning features provided by Elastic.

Requirements

To use machine learning features, you must have a Platinum or Enterprise license or a free 14-day Trial. File Data Visualizer requires a Basic license. For more info, refer to Set up machine learning features.

Setup local environment

Kibana

  1. Fork and clone the Kibana repo.

  2. Install nvm, node, yarn (for example, by using Homebrew). See Install dependencies.

  3. Make sure that Elasticsearch is deployed and running on localhost:9200.

  4. Navigate to the directory of the kibana repository on your machine.

  5. Fetch the latest changes from the repository.

  6. Checkout the branch of the version you want to use. For example, if you want to use a 7.9 version, run git checkout 7.9.

  7. Run nvm use. The response shows the Node version that the environment uses. If you need to update your Node version, the response message contains the command you need to run to do it.

  8. Run yarn kbn bootstrap. It takes all the dependencies in the code and installs/checks them. It is recommended to use it every time when you switch between branches.

  9. Make a copy of kibana.yml and save as kibana.dev.yml. (Git will not track the changes in kibana.dev.yml but yarn will use it.)

  10. Provide the appropriate password and user name in kibana.dev.yml.

  11. Run yarn start to start Kibana.

  12. Go to http://localhost:560x/xxx (check the terminal message for the exact path).

For more details, refer to this getting started page.

Adding sample data to Kibana

Kibana has sample data sets that you can add to your setup so that you can test different configurations on sample data.

  1. Click the Elastic logo in the upper left hand corner of your browser to navigate to the Kibana home page.

  2. Click Load a data set and a Kibana dashboard.

  3. Pick a data set or feel free to click Add on all of the available sample data sets.

These data sets are now ready be analyzed in ML jobs in Kibana.

Running tests

Jest tests

Run the test following jest tests from kibana/x-pack.

New snapshots, all plugins:

node scripts/jest

Update snapshots for the ML plugin:

node scripts/jest plugins/ml -u

Update snapshots for a specific directory only:

node scripts/jest plugins/ml/public/application/settings/filter_lists

Run tests with verbose output:

node scripts/jest plugins/ml --verbose

Functional tests

Before running the test server, make sure to quit all other instances of Elasticsearch.

Run the following commands from the x-pack directory and use separate terminals for test server and test runner. The test server command starts an Elasticsearch and Kibana instance that the tests will be run against.

  1. Functional UI tests with Trial license (default config):

     node scripts/functional_tests_server.js
     node scripts/functional_test_runner.js --include-tag mlqa
    

    ML functional Trial license tests are located in x-pack/test/functional/apps/ml.

  2. Functional UI tests with Basic license:

     node scripts/functional_tests_server.js --config test/functional_basic/config.ts
     node scripts/functional_test_runner.js --config test/functional_basic/config.ts --include-tag mlqa
    

    ML functional Basic license tests are located in x-pack/test/functional_basic/apps/ml.

  3. API integration tests with Trial license:

     node scripts/functional_tests_server.js
     node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag mlqa
    

    ML API integration Trial license tests are located in x-pack/test/api_integration/apis/ml.

  4. API integration tests with Basic license:

     node scripts/functional_tests_server.js --config test/api_integration_basic/config.ts
     node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag mlqa
    

    ML API integration Basic license tests are located in x-pack/test/api_integration_basic/apis/ml.

Shared functions

You can find the ML shared functions in the following files in GitHub:

https://github.com/elastic/kibana/blob/master/x-pack/plugins/ml/public/shared.ts
https://github.com/elastic/kibana/blob/master/x-pack/plugins/ml/server/shared.ts

These functions are shared from the root of the ML plugin, you can import them with an import statement. For example:

import { MlPluginSetup } from '../../../../ml/server';

or

import { ANOMALY_SEVERITY } from '../../ml/common';

Functions are shared from the following directories:

ml/common
ml/public
ml/server