Skip to content

[Fleet] Fix KQL filtering#183757

Merged
jillguyonnet merged 6 commits intoelastic:mainfrom
jillguyonnet:fleet/178069-fix-agent-policy-filtering
Jun 18, 2024
Merged

[Fleet] Fix KQL filtering#183757
jillguyonnet merged 6 commits intoelastic:mainfrom
jillguyonnet:fleet/178069-fix-agent-policy-filtering

Conversation

@jillguyonnet
Copy link
Copy Markdown
Member

@jillguyonnet jillguyonnet commented May 17, 2024

Summary

Closes #178069

This PR fixes agent policies KQL filtering in Fleet UI. Because agent policy data is retrieved from Saved Objects, the policy fields require the SO prefix (ingest-agent-policies), which was removed in #161064, to be present (see #178069 (comment) for details). A further ER captures the requirements for displaying custom labels without the prefix.

In Fleet UI, the SearchBar component that uses KQL filtering is used in three tabs:

  • Agents
  • Agent policies
  • Enrollment tokens

Note that the search inputs in the Uninstall tokens and Data streams tabs are simple text filtering, not KQL.

The filtering behaviour with this fix matches the one in 8.11.0 and is captured in the screen recording below:

  • Agents tab: agent fields (e.g. policy_id or agent.version)
  • Agent policies tab: agent policy fields prefixed with ingest-agent-policies (e.g. ingest-agent-policies.name)
  • Enrollment tokens tab: token fields (e.g. name or policy_id)

Screen recording

This screen recording shows working KQL filtering and suggestions for the three tabs (fixed for Agent policies):

Screen.Recording.2024-06-11.at.10.27.01.mov

Testing

  1. Create a few agent policies and enroll a couple of agents.
  2. Test that the expected fields are shown in the KQL search bars for agents, agent policies and enrollment tokens. For each, check that suggestions are shown when you select a particular field with existing values.
  3. For agent policies in particular, also check that KQL syntax works as expect. For instance, if you have an agent policy named "Test agent policy", the query ingest-agent-policies.name : *agent* should correctly filter for it.

Checklist

@jillguyonnet jillguyonnet self-assigned this May 17, 2024
@ghost
Copy link
Copy Markdown

ghost commented May 17, 2024

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet force-pushed the fleet/178069-fix-agent-policy-filtering branch from 6e09c89 to be5d70e Compare June 11, 2024 08:22
@jillguyonnet
Copy link
Copy Markdown
Member Author

/ci

@jillguyonnet jillguyonnet force-pushed the fleet/178069-fix-agent-policy-filtering branch from be5d70e to fb3ad99 Compare June 11, 2024 08:51
@jillguyonnet jillguyonnet added release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team labels Jun 11, 2024
@jillguyonnet
Copy link
Copy Markdown
Member Author

/ci

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jillguyonnet jillguyonnet requested a review from criamico June 11, 2024 13:35
@jillguyonnet
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

case `.${FLEET_ENROLLMENT_API_PREFIX}`:
// Saved Objects are stored in .kibana_ingest.
// Currently, the search bar is only used to query agent policies.
case INDEX_NAME:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: INDEX_NAME seems too generic, we could use INGEST_SAVED_OBJECT_INDEX which refers to the same constant.

export const INDEX_NAME = INGEST_SAVED_OBJECT_INDEX;

Copy link
Copy Markdown
Member

@criamico criamico left a comment

Choose a reason for hiding this comment

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

Thanks for fixing it! LGTM 🚢

Copy link
Copy Markdown
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@jillguyonnet
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@jillguyonnet
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@jillguyonnet
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #86 / serverless observability UI Dataset Quality Dataset quality table shows the last activity when in time range

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
fleet 1.4MB 1.4MB +22.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 165.8KB 165.4KB -397.0B

History

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

cc @jillguyonnet

@jillguyonnet jillguyonnet merged commit 1b5f598 into elastic:main Jun 18, 2024
@jillguyonnet jillguyonnet deleted the fleet/178069-fix-agent-policy-filtering branch June 18, 2024 12:54
@kibanamachine kibanamachine added v8.15.0 backport:skip This PR does not require backporting labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:fix Team:Fleet Team label for Observability Data Collection Fleet team v8.15.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet] Fix agent policies filtering

6 participants