Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solutions] (Phase 1) Adds an application cache called metrics entities and integrates it within Security Solutions behind a feature flag #96446

Merged
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
dcd3276
Initial framework code in place with lots of TODO's, all WIP.
FrankHassanabad Mar 29, 2021
9f84e84
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Mar 29, 2021
f93e293
Added a new module for all of security solutions and more metrics for…
FrankHassanabad Apr 2, 2021
5922ead
Added delete security_solutions and more notes to the README.md
FrankHassanabad Apr 2, 2021
66c6e21
Initial integration with the web application for querying (lots of wi…
FrankHassanabad Apr 5, 2021
33ef3cf
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 5, 2021
02d2acd
More bug fixes, changed out the names for smaller names of things
FrankHassanabad Apr 6, 2021
f55e528
Renamed plugin to be metrics_entities
FrankHassanabad Apr 6, 2021
9f28076
Renamed more files to use entities instead of summaries as that is mo…
FrankHassanabad Apr 6, 2021
fed2036
More renaming to keep things more concise
FrankHassanabad Apr 6, 2021
ed2ceb6
Renamed
FrankHassanabad Apr 6, 2021
ef1ccb8
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 6, 2021
04d22ba
Remove merged things that shouldn't be in tsconfig
FrankHassanabad Apr 7, 2021
179d6d1
Remove extra line
FrankHassanabad Apr 7, 2021
d4652ff
Cleanup and more todo blocks around areas
FrankHassanabad Apr 7, 2021
5e90728
Pushed the timerange back upwards to the front end, removed more TODO…
FrankHassanabad Apr 7, 2021
0a28e26
Updated the i18n key to work out
FrankHassanabad Apr 7, 2021
0a99e53
Added the matrix histogram that was missing from the refactor
FrankHassanabad Apr 7, 2021
45465a8
Removed accidental change from cases
FrankHassanabad Apr 7, 2021
6d29a66
Added feature flags to enable/disable the metrics_summary and disabli…
FrankHassanabad Apr 8, 2021
458e7e8
Added experimental flag support to the ui_settings now as well
FrankHassanabad Apr 8, 2021
408d0eb
Fixes unit tests to work with experimental and thus ... tada ... this…
FrankHassanabad Apr 11, 2021
ec09f42
Fixed server watch path jest test
FrankHassanabad Apr 12, 2021
19eed74
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 12, 2021
1d07694
Fixed error with jests from update from master
FrankHassanabad Apr 13, 2021
2cf992e
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 13, 2021
a70b3c2
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 13, 2021
046edc0
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 14, 2021
edfbb5b
Fix broken tests
FrankHassanabad Apr 14, 2021
dae2cac
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 15, 2021
5276c2d
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 15, 2021
67212fa
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 16, 2021
c31938b
Fix type issue
FrankHassanabad Apr 17, 2021
2fe2e89
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 17, 2021
1424d13
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 19, 2021
ec3d3eb
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 19, 2021
8770760
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 19, 2021
e1f52e7
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 19, 2021
34574be
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 19, 2021
42fb51c
Merge branch 'master' into add-summary-metrics-plugin
kibanamachine Apr 20, 2021
8126a27
Merge branch 'master' into add-summary-metrics-plugin
kibanamachine Apr 20, 2021
76725d3
Updated asciidoc
FrankHassanabad Apr 20, 2021
43fe201
Changed i18n from PR feedback
FrankHassanabad Apr 20, 2021
2565d9f
Fixed license information on the top of shell scripts
FrankHassanabad Apr 20, 2021
544deed
Fixes from PR review
FrankHassanabad Apr 20, 2021
3493b94
Fixed license files and linter to use the correct license
FrankHassanabad Apr 20, 2021
09fb2eb
Updated the other linter location and changed wrong paths
FrankHassanabad Apr 20, 2021
c05efb1
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 26, 2021
4c792a9
Removed duplicate key
FrankHassanabad Apr 26, 2021
aca1449
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 26, 2021
9ab9aec
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 26, 2021
4845c9c
Small fixes from PR review
FrankHassanabad Apr 26, 2021
ae5bfea
Add better logging with info from PR review
FrankHassanabad Apr 26, 2021
a63b3f1
Added some TODO blocks
FrankHassanabad Apr 26, 2021
a7f8d2d
Updated naming from Summary to Entities
FrankHassanabad Apr 27, 2021
7e25bc1
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 28, 2021
a16f17e
Adds a fix where the useUiSetting$ is not correct with the types and …
FrankHassanabad Apr 28, 2021
71b4f96
Fixes from PR comments from everyone
FrankHassanabad Apr 28, 2021
4ad83a3
Moved plugin over to the new tsconfig refs system
FrankHassanabad Apr 28, 2021
01fb63c
Added star pattern to be able to allow people to configure additional…
FrankHassanabad Apr 28, 2021
a7f478e
Changed 3d to be 1w
FrankHassanabad Apr 28, 2021
bd49ce3
Changed the created 1.0.0 for the Kibana version to match the transfo…
FrankHassanabad Apr 28, 2021
06570a1
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 29, 2021
8e717f8
Commited api docs
FrankHassanabad Apr 29, 2021
075ff1f
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 29, 2021
06d87df
Fixed up TODO comments
FrankHassanabad Apr 29, 2021
2270709
Updated README and some notes
FrankHassanabad Apr 29, 2021
d5ab054
Added docs that wanted to be updated
FrankHassanabad Apr 30, 2021
8c3e322
Merge branch 'master' into add-summary-metrics-plugin
FrankHassanabad Apr 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,118 @@ module.exports = {
'prefer-destructuring': 'error',
},
},
/**
* Metrics entities overrides
*/
{
// front end and common typescript and javascript files only
files: [
'x-pack/plugins/metrics_entities/public/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/metrics_entities/common/**/*.{js,mjs,ts,tsx}',
],
rules: {
'import/no-nodejs-modules': 'error',
'no-restricted-imports': [
'error',
{
// prevents UI code from importing server side code and then webpack including it when doing builds
patterns: ['**/server/*'],
},
],
},
},
{
// typescript and javascript for front and back end
files: ['x-pack/plugins/metrics_entities/**/*.{js,mjs,ts,tsx}'],
plugins: ['eslint-plugin-node'],
env: {
jest: true,
},
rules: {
'accessor-pairs': 'error',
'array-callback-return': 'error',
'no-array-constructor': 'error',
complexity: 'error',
'consistent-return': 'error',
'func-style': ['error', 'expression'],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
'node/no-deprecated-api': 'error',
'no-bitwise': 'error',
'no-continue': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty-character-class': 'error',
'no-empty-pattern': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-label': 'error',
'no-func-assign': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-regexp': 'error',
'no-inner-declarations': 'error',
'no-lone-blocks': 'error',
'no-multi-assign': 'error',
'no-misleading-character-class': 'error',
'no-new-symbol': 'error',
'no-obj-calls': 'error',
'no-param-reassign': ['error', { props: true }],
'no-process-exit': 'error',
'no-prototype-builtins': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-this-before-super': 'error',
// rely on typescript
'no-undef': 'off',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-concat': 'error',
'no-useless-computed-key': 'error',
'no-useless-escape': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-void': 'error',
'one-var-declaration-per-line': 'error',
'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'require-atomic-updates': 'error',
'symbol-description': 'error',
'vars-on-top': 'error',
'@typescript-eslint/explicit-member-accessibility': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'no-template-curly-in-string': 'error',
'sort-keys': 'error',
'prefer-destructuring': 'error',
},
},
/**
* Alerting Services overrides
*/
Expand Down
151 changes: 151 additions & 0 deletions api_docs/metrics_entities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"id": "metricsEntities",
"client": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": []
},
"server": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": [],
"setup": {
"id": "def-server.MetricsEntitiesPluginSetup",
"type": "Interface",
"label": "MetricsEntitiesPluginSetup",
"description": [],
"tags": [],
"children": [
{
"tags": [],
"id": "def-server.MetricsEntitiesPluginSetup.getMetricsEntitiesClient",
"type": "Function",
"label": "getMetricsEntitiesClient",
"description": [],
"source": {
"path": "x-pack/plugins/metrics_entities/server/types.ts",
"lineNumber": 15
},
"signature": [
"GetMetricsEntitiesClientType"
]
}
],
"source": {
"path": "x-pack/plugins/metrics_entities/server/types.ts",
"lineNumber": 14
},
"lifecycle": "setup",
"initialIsOpen": true
},
"start": {
"id": "def-server.MetricsEntitiesPluginStart",
"type": "Type",
"label": "MetricsEntitiesPluginStart",
"tags": [],
"description": [],
"source": {
"path": "x-pack/plugins/metrics_entities/server/types.ts",
"lineNumber": 18
},
"signature": [
"void"
],
"lifecycle": "start",
"initialIsOpen": true
}
},
"common": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [
{
"tags": [],
"id": "def-common.ELASTIC_NAME",
"type": "string",
"label": "ELASTIC_NAME",
"description": [
"\nGlobal prefix for all the transform jobs"
],
"source": {
"path": "x-pack/plugins/metrics_entities/common/constants.ts",
"lineNumber": 21
},
"signature": [
"\"estc\""
],
"initialIsOpen": false
},
{
"tags": [],
"id": "def-common.METRICS_ENTITIES_TRANSFORMS",
"type": "string",
"label": "METRICS_ENTITIES_TRANSFORMS",
"description": [
"\nTransforms route"
],
"source": {
"path": "x-pack/plugins/metrics_entities/common/constants.ts",
"lineNumber": 16
},
"initialIsOpen": false
},
{
"tags": [],
"id": "def-common.METRICS_ENTITIES_URL",
"type": "string",
"label": "METRICS_ENTITIES_URL",
"description": [
"\nBase route"
],
"source": {
"path": "x-pack/plugins/metrics_entities/common/constants.ts",
"lineNumber": 11
},
"signature": [
"\"/api/metrics_entities\""
],
"initialIsOpen": false
},
{
"tags": [],
"id": "def-common.PLUGIN_ID",
"type": "string",
"label": "PLUGIN_ID",
"description": [],
"source": {
"path": "x-pack/plugins/metrics_entities/common/index.ts",
"lineNumber": 8
},
"signature": [
"\"metricsEntities\""
],
"initialIsOpen": false
},
{
"tags": [],
"id": "def-common.PLUGIN_NAME",
"type": "string",
"label": "PLUGIN_NAME",
"description": [],
"source": {
"path": "x-pack/plugins/metrics_entities/common/index.ts",
"lineNumber": 9
},
"signature": [
"\"metrics_entities\""
],
"initialIsOpen": false
}
],
"objects": []
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: This was auto generated running some tooling, so I am going to take a stab at checking it in! :-)

It looked right as there are other docs in this folder.

26 changes: 26 additions & 0 deletions api_docs/metrics_entities.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
id: kibMetricsEntitiesPluginApi
slug: /kibana-dev-docs/metricsEntitiesPluginApi
title: metricsEntities
image: https://source.unsplash.com/400x175/?github
summary: API docs for the metricsEntities plugin
date: 2020-11-16
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'metricsEntities']
warning: This document is auto-generated and is meant to be viewed inside our experimental, new docs system. Reach out in #docs-engineering for more info.
---

import metricsEntitiesObj from './metrics_entities.json';

## Server

### Setup
<DocDefinitionList data={[metricsEntitiesObj.server.setup]}/>

### Start
<DocDefinitionList data={[metricsEntitiesObj.server.start]}/>

## Common

### Consts, variables and types
<DocDefinitionList data={metricsEntitiesObj.common.misc}/>

4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ using the CURL scripts in the scripts folder.
|Visualize geo data from Elasticsearch or 3rd party geo-services.


|{kib-repo}blob/{branch}/x-pack/plugins/metrics_entities/README.md[metricsEntities]
|Metrics entities where you can add transforms for metrics and entities.


|{kib-repo}blob/{branch}/x-pack/plugins/ml/readme.md[ml]
|This plugin provides access to the machine learning features provided by
Elastic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ it('produces the right watch and ignore list', () => {
<absolute path>/x-pack/plugins/lists/server/scripts,
<absolute path>/x-pack/plugins/security_solution/scripts,
<absolute path>/x-pack/plugins/security_solution/server/lib/detection_engine/scripts,
<absolute path>/x-pack/plugins/metrics_entities/server/scripts,
]
`);
});
1 change: 1 addition & 0 deletions packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function getServerWatchPaths({ pluginPaths, pluginScanDirs }: Options) {
fromRoot('x-pack/plugins/lists/server/scripts'),
fromRoot('x-pack/plugins/security_solution/scripts'),
fromRoot('x-pack/plugins/security_solution/server/lib/detection_engine/scripts'),
fromRoot('x-pack/plugins/metrics_entities/server/scripts'),
];

return {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"x-pack/typings/**/*",
"x-pack/tasks/**/*",
"x-pack/plugins/lists/**/*",
"x-pack/plugins/security_solution/**/*",
"x-pack/plugins/security_solution/**/*"
],
"exclude": [
"x-pack/plugins/security_solution/cypress/**/*"
Expand Down Expand Up @@ -110,6 +110,7 @@
{ "path": "./x-pack/plugins/licensing/tsconfig.json" },
{ "path": "./x-pack/plugins/logstash/tsconfig.json" },
{ "path": "./x-pack/plugins/maps/tsconfig.json" },
{ "path": "./x-pack/plugins/metrics_entities/tsconfig.json" },
{ "path": "./x-pack/plugins/ml/tsconfig.json" },
{ "path": "./x-pack/plugins/monitoring/tsconfig.json" },
{ "path": "./x-pack/plugins/observability/tsconfig.json" },
Expand Down
1 change: 1 addition & 0 deletions tsconfig.refs.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
{ "path": "./x-pack/plugins/licensing/tsconfig.json" },
{ "path": "./x-pack/plugins/logstash/tsconfig.json" },
{ "path": "./x-pack/plugins/maps/tsconfig.json" },
{ "path": "./x-pack/plugins/metrics_entities/tsconfig.json" },
{ "path": "./x-pack/plugins/ml/tsconfig.json" },
{ "path": "./x-pack/plugins/monitoring/tsconfig.json" },
{ "path": "./x-pack/plugins/observability/tsconfig.json" },
Expand Down
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"xpack.logstash": ["plugins/logstash"],
"xpack.main": "legacy/plugins/xpack_main",
"xpack.maps": ["plugins/maps"],
"xpack.metricsEntities": "plugins/metrics_entities",
"xpack.ml": ["plugins/ml"],
"xpack.monitoring": ["plugins/monitoring"],
"xpack.osquery": ["plugins/osquery"],
Expand Down
34 changes: 34 additions & 0 deletions x-pack/plugins/metrics_entities/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# metrics_entities

Metrics entities where you can add transforms for metrics and entities.

The transform jobs are on the file system as:
- modules (The different logical pieces)

When you create a "group" of transforms you can create them using an optional prefix to separate things based on queries, security concerns, or different Kibana spaces.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will want to expand upon setup instructions and detail what feature flags need to be flipped to enable. Also will want to add a section for disabling and detailing any manually steps necessary to perform cleanup of any lingering transforms (since those aren't cleaned up automatically on disable).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, adding it to my current TODO list. Might not happen in this PR right now but should happen as I flush out those details.

---

## Scripts

TODO: Add a note about scripts, setup, and running

## Development

TODO: Add how to develop here

## TODO List
- Add these properties to the route which are:
- disable_transforms,
- pipeline,
- Change the REST routes on post to change the indexes for whichever indexes you want
- Unit tests to ensure the data of the mapping.json includes the correct fields such as
_meta, at least one alias, a mapping section, etc...
- Add text/keyword and other things to the mappings (not just keyword maybe?) ... At least review them one more time
- Module (server/modules) templating with variables and then push those variables down? (Maybe we don't need them)
- Add feature flag and have it turned off
- Add lib/modules folder with the transforms inside of it
- Add the REST Kibana security based tags if needed and push those to any plugins using this plugin. Something like: tags: ['access:metricsEntities-read'] and ['access:metricsEntities-all'],
- Add schema validation choosing some schema library (io-ts or Kibana Schema or ... )
- Add unit tests
- Add e2e tests
- Move ui code into this plugin from security solutions? (maybe?)
Loading