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

[UII] Allow to reset log level for agents >= 8.15.0 #183434

Merged
merged 10 commits into from
May 16, 2024

Conversation

jen-huang
Copy link
Contributor

@jen-huang jen-huang commented May 14, 2024

‼️ Should be reverted if elastic/elastic-agent#4747 does not make 8.15.0.

Summary

Resolves #180778

This PR allows agent log level to be reset back to the level set on its policy (or if not set, simply the default agent level, see elastic/elastic-agent#3090).

To achieve this, this PR:

  • Allows null to be passed for the log level settings action, i.e.:
POST kbn:/api/fleet/agents/<AGENT_ID>/actions
{"action":{"type":"SETTINGS","data":{"log_level": null}}}
  • Enables the agent policy log level setting implemented in [Fleet] Expose agent logging level in agent policy settings #180607
  • Always show Apply changes on the agent details > Logs tab
  • For agents >= 8.15.0, always show Reset to policy on the agent details > Logs tab
  • Ensures both buttons are disabled if user does not have access to write to agents
image image

Caveats

  1. The reported agent log level is not accurate if agent is using the level from its policy and does not have a log level set on its own level (log_level metadata is not accurate elastic-agent#4747), so the initial selection on the agent log level could be wrong
  2. We have no way to tell where the log level came from (log_level source should be reported elastic-agent#4748), so that's why Apply changes and Reset to policy are always shown

Testing

Use the latest 8.15.0-SNAPSHOT for agents or fleet server to test this change

Checklist

Delete any items that are not applicable to this PR.

@jen-huang jen-huang self-assigned this May 14, 2024
@apmmachine
Copy link
Contributor

🤖 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!)

@jen-huang jen-huang added release_note:feature Makes this part of the condensed release notes v8.15.0 Team:Fleet Team label for Observability Data Collection Fleet team labels May 14, 2024
@jen-huang jen-huang marked this pull request as ready for review May 15, 2024 18:49
@jen-huang jen-huang requested review from a team as code owners May 15, 2024 18:49
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jen-huang jen-huang changed the title [UII][WIP] Allow to reset log level for agents >= 8.15.0 [UII] Allow to reset log level for agents >= 8.15.0 May 15, 2024
@jen-huang
Copy link
Contributor Author

/ci

Copy link
Contributor

@kilfoyle kilfoyle left a comment

Choose a reason for hiding this comment

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

LGTM for the text! 👍
I'll add this setting into the Fleet settings page as well.

@kibana-ci
Copy link
Collaborator

💚 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
fleet 1.3MB 1.3MB +1.3KB

Page load bundle

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

id before after diff
fleet 164.2KB 164.1KB -99.0B

History

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

cc @jen-huang

Copy link
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.

Changes LGTM

@jen-huang jen-huang merged commit 4c80f26 into elastic:main May 16, 2024
24 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 16, 2024
@jen-huang jen-huang deleted the feat/reset-log-level branch May 16, 2024 15:42
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 release_note:feature Makes this part of the condensed release notes 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] Allow to reset agents log level to honor agent policy log level
7 participants