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 Solution] Implement rule monitoring dashboard #159875

Merged
merged 3 commits into from
Jun 20, 2023

Conversation

banderror
Copy link
Contributor

@banderror banderror commented Jun 17, 2023

Epic: https://github.com/elastic/security-team/issues/6032 (internal)

Summary

This PR adds a new [Elastic Security] Detection rule monitoring Kibana dashboard and a new POST /internal/detection_engine/health/_setup API endpoint.

Dashboard

The dashboard can be helpful for monitoring the health and performance of Security detection rules. Users of the dashboard must have read access to the .kibana-event-log-* index (see below for exact requirements). The dashboard is automatically installed into the current Kibana space when a user visits a page in Security Solution - similar to how we install the Fleet package with prebuilt detection rules.

Kibana dashboards page Security dashboards page

Rule monitoring dashboard itself

API endpoint

The PR also adds a new endpoint for setting up anything related to monitoring rules and the health of the Detection Engine. If you call the endpoint, it will install the new dashboard to the Default Kibana space:

POST /internal/detection_engine/health/_setup

In order to install the dashboard to a different Kibana space, you will need to call it like that:

POST /s/<space-id>/internal/detection_engine/health/_setup

RBAC requirements

For installing the dashboard

The user calling the POST /internal/detection_engine/health/_setup endpoint must have at least Read access to Security Solution. No additional privileges are required, because the endpoint installs the dashboard on behalf of the internal user (kibana_system).

Screenshot 2023-06-22 at 21 00 58

For viewing the dashboard

In order to be able to view the dashboard, users will need to have at least the following 2 privileges:

  1. At least Read access to Kibana dashboards (Analytics -> Dashboard : Read)
Screenshot 2023-06-22 at 20 49 38
  1. At least read access to the .kibana-event-log-* index.
Screenshot 2023-06-22 at 20 52 10

Checklist

@banderror banderror added Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. release_note:feature Makes this part of the condensed release notes Feature:Rule Monitoring Security Solution Detection Rule Monitoring area Team:Detection Rule Management Security Detection Rule Management Team v8.9.0 labels Jun 17, 2023
@banderror banderror self-assigned this Jun 17, 2023
@banderror banderror force-pushed the security-rule-perfmon-dashboard branch from 04f313c to cd3c358 Compare June 17, 2023 02:37
@banderror banderror marked this pull request as ready for review June 17, 2023 02:53
@banderror banderror requested review from a team as code owners June 17, 2023 02:53
@banderror banderror requested a review from xcrzx June 17, 2023 02:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@banderror banderror force-pushed the security-rule-perfmon-dashboard branch from cd3c358 to 34f04a3 Compare June 19, 2023 09:21
@banderror banderror requested review from jpdjere and removed request for xcrzx June 19, 2023 10:02
Copy link
Contributor

@jpdjere jpdjere left a comment

Choose a reason for hiding this comment

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

Installed successfully, tested and working as described 👍

Are we not planning on adding this dashboard to the Security Dashboards page?
It's hard to find through the general dashboards list.

@banderror banderror force-pushed the security-rule-perfmon-dashboard branch from 34f04a3 to 50507b2 Compare June 19, 2023 13:04
@approksiu
Copy link

Installed successfully, tested and working as described 👍

Are we not planning on adding this dashboard to the Security Dashboards page? It's hard to find through the general dashboards list.

We should add it there - by adding "Security Solution" tag. cc @banderror

@banderror
Copy link
Contributor Author

banderror commented Jun 19, 2023

Based on the received feedback I'm starting to work on the following fixes and improvements:

  • Docs
    • Open a ticket for documenting the dashboard in the user-facing docs (ticket)
    • Known issue should be added to the release notes: rule can write multiple final statuses per execution; can be often caused by gap detection (ticket)
  • Fix the dashboard itself
    • Change the "top 5 rules" label to "top 5 rules per interval"
    • Add descriptions to all the panels
    • Fix the 3 tables at the bottom by adding columns properly
    • Add the Managed and Security Solution tags to the dashboard as it was done for the Threat Intelligence Overview dashboard
  • Fix the way the dashboard gets installed
    • Install it on behalf of the internal user
    • Remove the installation on Kibana server start
    • Call the _setup endpoint from all Security Solution pages, similar to how we install the package with prebuilt rules

@banderror banderror force-pushed the security-rule-perfmon-dashboard branch from 50507b2 to 3016d42 Compare June 19, 2023 19:48
@banderror banderror force-pushed the security-rule-perfmon-dashboard branch from c73c6ae to 799686f Compare June 19, 2023 23:19
@banderror
Copy link
Contributor Author

@approksiu @jpdjere I addressed all the feedback and updated the PR description accordingly. Hopefully, the CI will pass and the PR will be merged soon.

@banderror banderror merged commit 8fcf475 into elastic:main Jun 20, 2023
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #11 / telemetry Telemetry service Opt-in/out banners shows the banner in the default configuration

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 4197 4198 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 10.9MB 11.0MB +17.7KB
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 411 415 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 494 498 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @banderror

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 20, 2023
@banderror banderror deleted the security-rule-perfmon-dashboard branch June 20, 2023 04:16
banderror added a commit that referenced this pull request Jun 21, 2023
…PI (#160137)

**Partially addresses:** #125642

## Summary

- fixes typos noticed by @maximpn in
#159970 (comment)
- adds additional docs for #159875
banderror added a commit that referenced this pull request Jun 27, 2023
**Epic:** elastic/security-team#6032
(internal)
**Related to:** #159875

## Summary

In this PR we:

- add a text block to the dashboard itself with helpful info about it
- fix the 4 tables at the bottom of the dashboard
- add unit tests for the dashboard's source `.json` files

## Text block

<img width="1792" alt="Screenshot 2023-06-22 at 20 15 30"
src="https://github.com/elastic/kibana/assets/7359339/55d267b7-7c39-4cdf-a917-fd17e9231a59">

## Tables

There were two issues with the tables:

1. When having the same prebuilt rules installed in two or more Kibana
spaces, sorting in a table could break if the table rendered two
different rules with the same name. It has been fixed by making the rule
ID the first field in the table and making a few minor tweaks. Thanks to
@maximpn for noticing the bug.
2. Widths of the columns were off in some cases.

The fixed tables look like that:

<img width="1775" alt="Screenshot 2023-06-22 at 19 52 13"
src="https://github.com/elastic/kibana/assets/7359339/53475848-3238-4866-af70-080b8acd1f9e">

## Full comparison

| **BEFORE** | **AFTER** |
|:------------:|:-----------:|
| ![Dashboard
BEFORE](https://github.com/elastic/kibana/assets/7359339/755cc044-5613-4c78-b89f-2a9734ded76d)
| ![Dashboard
AFTER](https://github.com/elastic/kibana/assets/7359339/38ac67f7-b9f8-4ddf-833f-e8e98eb2bfb1)
|


### Checklist

- [x] 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/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
    - elastic/security-docs#3478
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 27, 2023
**Epic:** elastic/security-team#6032
(internal)
**Related to:** elastic#159875

## Summary

In this PR we:

- add a text block to the dashboard itself with helpful info about it
- fix the 4 tables at the bottom of the dashboard
- add unit tests for the dashboard's source `.json` files

## Text block

<img width="1792" alt="Screenshot 2023-06-22 at 20 15 30"
src="https://github.com/elastic/kibana/assets/7359339/55d267b7-7c39-4cdf-a917-fd17e9231a59">

## Tables

There were two issues with the tables:

1. When having the same prebuilt rules installed in two or more Kibana
spaces, sorting in a table could break if the table rendered two
different rules with the same name. It has been fixed by making the rule
ID the first field in the table and making a few minor tweaks. Thanks to
@maximpn for noticing the bug.
2. Widths of the columns were off in some cases.

The fixed tables look like that:

<img width="1775" alt="Screenshot 2023-06-22 at 19 52 13"
src="https://github.com/elastic/kibana/assets/7359339/53475848-3238-4866-af70-080b8acd1f9e">

## Full comparison

| **BEFORE** | **AFTER** |
|:------------:|:-----------:|
| ![Dashboard
BEFORE](https://github.com/elastic/kibana/assets/7359339/755cc044-5613-4c78-b89f-2a9734ded76d)
| ![Dashboard
AFTER](https://github.com/elastic/kibana/assets/7359339/38ac67f7-b9f8-4ddf-833f-e8e98eb2bfb1)
|

### Checklist

- [x] 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/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
    - elastic/security-docs#3478

(cherry picked from commit f622809)
kibanamachine referenced this pull request Jun 27, 2023
…60617)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Security Solution] Fix rule monitoring dashboard
(#160316)](#160316)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Georgii
Gorbachev","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-27T12:45:12Z","message":"[Security
Solution] Fix rule monitoring dashboard (#160316)\n\n**Epic:**
https://github.com/elastic/security-team/issues/6032\r\n(internal)\r\n**Related
to:** https://github.com/elastic/kibana/pull/159875\r\n\r\n##
Summary\r\n\r\nIn this PR we:\r\n\r\n- add a text block to the dashboard
itself with helpful info about it\r\n- fix the 4 tables at the bottom of
the dashboard\r\n- add unit tests for the dashboard's source `.json`
files\r\n\r\n## Text block\r\n\r\n<img width=\"1792\" alt=\"Screenshot
2023-06-22 at 20 15
30\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/55d267b7-7c39-4cdf-a917-fd17e9231a59\">\r\n\r\n##
Tables\r\n\r\nThere were two issues with the tables:\r\n\r\n1. When
having the same prebuilt rules installed in two or more
Kibana\r\nspaces, sorting in a table could break if the table rendered
two\r\ndifferent rules with the same name. It has been fixed by making
the rule\r\nID the first field in the table and making a few minor
tweaks. Thanks to\r\n@maximpn for noticing the bug.\r\n2. Widths of the
columns were off in some cases.\r\n\r\nThe fixed tables look like
that:\r\n\r\n<img width=\"1775\" alt=\"Screenshot 2023-06-22 at 19 52
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/53475848-3238-4866-af70-080b8acd1f9e\">\r\n\r\n##
Full comparison\r\n\r\n| **BEFORE** | **AFTER**
|\r\n|:------------:|:-----------:|\r\n|
![Dashboard\r\nBEFORE](https://github.com/elastic/kibana/assets/7359339/755cc044-5613-4c78-b89f-2a9734ded76d)\r\n|
![Dashboard\r\nAFTER](https://github.com/elastic/kibana/assets/7359339/38ac67f7-b9f8-4ddf-833f-e8e98eb2bfb1)\r\n|\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n -
https://github.com/elastic/security-docs/issues/3478","sha":"f622809ee824a3341d767e7174177fbe7ac9578b","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","impact:high","Team:Detections
and Resp","Team: SecuritySolution","Feature:Rule
Monitoring","Team:Detection Rule
Management","v8.9.0","v8.10.0"],"number":160316,"url":"https://github.com/elastic/kibana/pull/160316","mergeCommit":{"message":"[Security
Solution] Fix rule monitoring dashboard (#160316)\n\n**Epic:**
https://github.com/elastic/security-team/issues/6032\r\n(internal)\r\n**Related
to:** https://github.com/elastic/kibana/pull/159875\r\n\r\n##
Summary\r\n\r\nIn this PR we:\r\n\r\n- add a text block to the dashboard
itself with helpful info about it\r\n- fix the 4 tables at the bottom of
the dashboard\r\n- add unit tests for the dashboard's source `.json`
files\r\n\r\n## Text block\r\n\r\n<img width=\"1792\" alt=\"Screenshot
2023-06-22 at 20 15
30\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/55d267b7-7c39-4cdf-a917-fd17e9231a59\">\r\n\r\n##
Tables\r\n\r\nThere were two issues with the tables:\r\n\r\n1. When
having the same prebuilt rules installed in two or more
Kibana\r\nspaces, sorting in a table could break if the table rendered
two\r\ndifferent rules with the same name. It has been fixed by making
the rule\r\nID the first field in the table and making a few minor
tweaks. Thanks to\r\n@maximpn for noticing the bug.\r\n2. Widths of the
columns were off in some cases.\r\n\r\nThe fixed tables look like
that:\r\n\r\n<img width=\"1775\" alt=\"Screenshot 2023-06-22 at 19 52
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/53475848-3238-4866-af70-080b8acd1f9e\">\r\n\r\n##
Full comparison\r\n\r\n| **BEFORE** | **AFTER**
|\r\n|:------------:|:-----------:|\r\n|
![Dashboard\r\nBEFORE](https://github.com/elastic/kibana/assets/7359339/755cc044-5613-4c78-b89f-2a9734ded76d)\r\n|
![Dashboard\r\nAFTER](https://github.com/elastic/kibana/assets/7359339/38ac67f7-b9f8-4ddf-833f-e8e98eb2bfb1)\r\n|\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n -
https://github.com/elastic/security-docs/issues/3478","sha":"f622809ee824a3341d767e7174177fbe7ac9578b"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/160316","number":160316,"mergeCommit":{"message":"[Security
Solution] Fix rule monitoring dashboard (#160316)\n\n**Epic:**
https://github.com/elastic/security-team/issues/6032\r\n(internal)\r\n**Related
to:** https://github.com/elastic/kibana/pull/159875\r\n\r\n##
Summary\r\n\r\nIn this PR we:\r\n\r\n- add a text block to the dashboard
itself with helpful info about it\r\n- fix the 4 tables at the bottom of
the dashboard\r\n- add unit tests for the dashboard's source `.json`
files\r\n\r\n## Text block\r\n\r\n<img width=\"1792\" alt=\"Screenshot
2023-06-22 at 20 15
30\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/55d267b7-7c39-4cdf-a917-fd17e9231a59\">\r\n\r\n##
Tables\r\n\r\nThere were two issues with the tables:\r\n\r\n1. When
having the same prebuilt rules installed in two or more
Kibana\r\nspaces, sorting in a table could break if the table rendered
two\r\ndifferent rules with the same name. It has been fixed by making
the rule\r\nID the first field in the table and making a few minor
tweaks. Thanks to\r\n@maximpn for noticing the bug.\r\n2. Widths of the
columns were off in some cases.\r\n\r\nThe fixed tables look like
that:\r\n\r\n<img width=\"1775\" alt=\"Screenshot 2023-06-22 at 19 52
13\"\r\nsrc=\"https://github.com/elastic/kibana/assets/7359339/53475848-3238-4866-af70-080b8acd1f9e\">\r\n\r\n##
Full comparison\r\n\r\n| **BEFORE** | **AFTER**
|\r\n|:------------:|:-----------:|\r\n|
![Dashboard\r\nBEFORE](https://github.com/elastic/kibana/assets/7359339/755cc044-5613-4c78-b89f-2a9734ded76d)\r\n|
![Dashboard\r\nAFTER](https://github.com/elastic/kibana/assets/7359339/38ac67f7-b9f8-4ddf-833f-e8e98eb2bfb1)\r\n|\r\n\r\n\r\n###
Checklist\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n -
https://github.com/elastic/security-docs/issues/3478","sha":"f622809ee824a3341d767e7174177fbe7ac9578b"}}]}]
BACKPORT-->

Co-authored-by: Georgii Gorbachev <[email protected]>
@philippkahr
Copy link
Contributor

@banderror don't know where to comment else wise. If you check the data view you are using you can append a data formatter for the fields. E.g. the duration fields, you can mark them as duration and milliseconds. This will change the output from numbers to readable output and automatically scale accordingly. All of the sudden you are in the 100s of seconds? You would see 100 seconds, or 1m 40s as a value.

Screenshot 2023-07-19 at 15 51 04 Screenshot 2023-07-19 at 15 52 58 Screenshot 2023-07-19 at 15 53 31

@banderror
Copy link
Contributor Author

Thanks for the suggestion @philippkahr, I think this could be a nice usability enhancement. Would you mind opening an issue in https://github.com/elastic/kibana for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Rule Monitoring Security Solution Detection Rule Monitoring area release_note:feature Makes this part of the condensed release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants