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

[Fleet] Allow to send SETTINGS action #83707

Merged
merged 5 commits into from
Nov 20, 2020

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Nov 18, 2020

Summary

Partially resolve #83330

To be able to dynamically set the log level of an agent, we need to send a new action to the agent with that log_level

This pull request update the actions endpoint to be able to send that new SETTINGS action.

Note action will exists in Fleet Server so there is no issue of adding a new one.

Tests

I added an API integration test to ensure we can create that action.

If you want to test it manually you can enroll an agent, checkin, create a SETTINGS action, then checkin again you will have the action.

curl --request POST \
  --url http://localhost:5601/api/ingest_manager/fleet/agents/{AGENT_ID}/actions \
  --header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==' \
  --header 'Content-Type: application/json' \
  --header 'kbn-xsrf: as' \
  --data '{
	"action": {
			"type": "SETTINGS",
		"data": {
			"log_level": "debug"
		}
	}
}'

cc @michalpristas

@nchaulet nchaulet added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 labels Nov 18, 2020
@nchaulet nchaulet requested a review from a team November 18, 2020 19:34
@nchaulet nchaulet self-assigned this Nov 18, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

]),
data: schema.maybe(schema.any()),
ack_data: schema.maybe(schema.any()),
sent_at: schema.maybe(schema.string()),
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed sent_at and ack_data as there is no need for them when creating an action

Copy link
Contributor

Choose a reason for hiding this comment

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

should we change saved object definition and add migrations to match?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's required in the saved_object we update that when the agent acknowledge an action, but it's not on a new action

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

LGTM

@michalpristas
Copy link

i will send log_level in agent metadata next to fields like upgradeable or version
can we make it visible on details page?

@nchaulet
Copy link
Member Author

@michalpristas Yes I will create a PR to show the log_level and the UI to perform the action as soon this is merged #83356 (review)

@nchaulet nchaulet merged commit c1a263c into elastic:master Nov 20, 2020
@nchaulet nchaulet deleted the feature-fleet-settings-action branch November 20, 2020 14:21
nchaulet added a commit to nchaulet/kibana that referenced this pull request Nov 20, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Nov 20, 2020
* master: (38 commits)
  [ML] Data frame analytics: Adds functionality to map view (elastic#83710)
  Add usage collection for savedObject tagging (elastic#83160)
  [SECURITY_SOLUTION] 145: Advanced Policy Tests (elastic#82898)
  [APM] Service overview transactions table (elastic#83429)
  [ML] Fix Single Metric Viewer not loading if job is metric with no partition (elastic#83880)
  do not export types from 3rd party modules as 'type' (elastic#83803)
  [Fleet] Allow to send SETTINGS action (elastic#83707)
  Fixes Failing test: Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details·ts - Actions and Triggers app Alert Details Alert Instances renders the active alert instances (elastic#83478)
  [Uptime]Reduce chart height on monitor detail page (elastic#83777)
  [APM] Prefer `APIReturnType` over `PromiseReturnType` (elastic#83843)
  [Observability] Fix telemetry for Observability Overview (elastic#83847)
  [Alerting] Adds generic UI for the definition of conditions for Action Groups (elastic#83278)
  ensure workload agg doesnt run until next interval when it fails (elastic#83632)
  [ILM] Policy form should not throw away data (elastic#83077)
  [Monitoring] Stop collecting Kibana Usage in bulkUploader (elastic#83546)
  [TSVB] fix wrong imports (elastic#83798)
  [APM] Correlations UI POC (elastic#82256)
  list all the refs in  tsconfig.json (elastic#83678)
  Bump jest (and related packages) to v26.6.3 (elastic#83724)
  Functional tests - stabilize reporting tests for cloud execution (elastic#83787)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Allow to config Agent log level
5 participants