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][Endpoint]Activity Log API/UX changes #114905

Merged
merged 31 commits into from
Oct 19, 2021
Merged

[Security Solution][Endpoint]Activity Log API/UX changes #114905

merged 31 commits into from
Oct 19, 2021

Conversation

ashokaditya
Copy link
Member

@ashokaditya ashokaditya commented Oct 13, 2021

Summary

In addition to fleet actions and responses in the activity log, this PR enriches the log by showing successful or failed action responses that were completed when the endpoint finishes executing the action request.

  • finds unique action_ids for each agent from .fleet-actions and .logs-endpoint.actions-default indices, if the new endpoint action index exists. Otherwise, finds action_ids from .fleet-actions index.
  • finds all matching action_id responses from .fleet-action-results and .logs-endpoint.action.responses-default indices if it exists. Distinguishes each type of record by labeling them fleetResponse or response (for endpoint responses)
  • Filters out endpoint actions (as they are duplicates of fleet actions) and labels the results as fleetAction. Since we want to continue showing fleet action requests, fleet action responses, and the new endpoint response (as completed response).
  • shows endpoint actions that have failed to be delivered to fleet with matching endpoint responses that didn't execute.
  • merges actions and responses as it did earlier to display in the log UI.

image

with actions/responses that didn't make to fleet:

image
image

Checklist

Delete any items that are not applicable to this PR.

@ashokaditya ashokaditya self-assigned this Oct 13, 2021
@ashokaditya ashokaditya added auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 v8.0.0 release_note:feature Makes this part of the condensed release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution labels Oct 13, 2021
@ashokaditya
Copy link
Member Author

@elasticmachine merge upstream

@ashokaditya ashokaditya marked this pull request as ready for review October 14, 2021 19:01
@ashokaditya ashokaditya requested review from a team as code owners October 14, 2021 19:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

@ashokaditya ashokaditya requested a review from pzl October 14, 2021 19:02
Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

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

getActivityLog() is getting pretty big. It's hard to read through the logic top-to-bottom and understand why we're doing any of those operations. Can you refactor and split some of those sections into functions, and then getActivityLog()'s purpose can be described by reading those function names?

Simplify `getActivityLog` so it is easier to reason with.
review comments
@@ -912,6 +932,25 @@ describe('when on the endpoint list page', () => {
expect(`${logEntries[1]} .euiCommentTimeline__icon--regular`).not.toBe(null);
});

it('should display log accurately with endpoint responses', async () => {
const activityLogTab = await renderResult.findByTestId('activity_log');
reactTestingLibrary.act(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to take action, but just so you know, userEvent is available in kibana and avoids the whole having to wrap this in act https://testing-library.com/docs/ecosystem-user-event/

Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

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

🐑

@ashokaditya ashokaditya enabled auto-merge (squash) October 18, 2021 14:51
@ashokaditya
Copy link
Member Author

@elasticmachine merge upstream

@kevinlog
Copy link
Contributor

I also checked this our and tried it. After a fix from @ferullo it should work!

With the Endpoint that has the fix to get the activity log working
image

@ashokaditya
Copy link
Member Author

I also checked this our and tried it. After a fix from @ferullo it should work!

With the Endpoint that has the fix to get the activity log working

Fantastic @kevinlog 🎉

@ashokaditya
Copy link
Member Author

@elasticmachine merge upstream

@kevinlog
Copy link
Contributor

@elasticmachine merge upstream

@kevinlog
Copy link
Contributor

@elasticmachine merge upstream

@kevinlog
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 4.6MB 4.6MB +2.6KB

History

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

cc @ashokaditya

@ashokaditya ashokaditya merged commit d0bc10f into elastic:master Oct 19, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 19, 2021
)

* rename legacy actions/responses

fixes elastic/security-team/issues/1702

* use correct name for responses index

refs elastic/pull/113621

* extract helper method to utils

* append endpoint responses docs to activity log

* Show completed responses on activity log

fixes elastic/security-team/issues/1703

* remove width restriction on date picker

* add a simple test to verify endpoint responses

fixes elastic/security-team/issues/1702

* find unique action_ids from `.fleet-actions` and `.logs-endpoint.actions-default` indices

fixes elastic/security-team/issues/1702

* do not filter out endpoint only actions/responses that did not make it to Fleet

review comments

* use a constant to manage various doc types

review comments

* refactor `getActivityLog`

Simplify `getActivityLog` so it is easier to reason with.
review comments

* skip this for now

will mock this better in a new PR

* improve types

* display endpoint actions similar to fleet actions, but with success icon color

* Correctly do mocks for tests

* Include only errored endpoint actions, remove successful duplicates

fixes elastic/security-team/issues/1703

* Update tests to use non duplicate action_ids

review comments
fixes elastic/security-team/issues/1703

* show correct action title

review fixes

* statusCode constant

review change

* rename

review changes

* Update translations.ts

refs elastic@74a8340

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

@ashokaditya ashokaditya deleted the feat/olm-activity_log_API_UX-1702 branch October 19, 2021 06:55
kibanamachine added a commit that referenced this pull request Oct 19, 2021
…115492)

* rename legacy actions/responses

fixes elastic/security-team/issues/1702

* use correct name for responses index

refs /pull/113621

* extract helper method to utils

* append endpoint responses docs to activity log

* Show completed responses on activity log

fixes elastic/security-team/issues/1703

* remove width restriction on date picker

* add a simple test to verify endpoint responses

fixes elastic/security-team/issues/1702

* find unique action_ids from `.fleet-actions` and `.logs-endpoint.actions-default` indices

fixes elastic/security-team/issues/1702

* do not filter out endpoint only actions/responses that did not make it to Fleet

review comments

* use a constant to manage various doc types

review comments

* refactor `getActivityLog`

Simplify `getActivityLog` so it is easier to reason with.
review comments

* skip this for now

will mock this better in a new PR

* improve types

* display endpoint actions similar to fleet actions, but with success icon color

* Correctly do mocks for tests

* Include only errored endpoint actions, remove successful duplicates

fixes elastic/security-team/issues/1703

* Update tests to use non duplicate action_ids

review comments
fixes elastic/security-team/issues/1703

* show correct action title

review fixes

* statusCode constant

review change

* rename

review changes

* Update translations.ts

refs 74a8340

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Ashokaditya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:feature Makes this part of the condensed release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants