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] Log agent usage every n minutes #144037

Merged
merged 4 commits into from
Oct 31, 2022
Merged

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Oct 26, 2022

Summary

Resolve #140014

Depends on #144033

Log periodically the agent status, and fleet server agent status like this

Screen Shot 2022-10-26 at 9 25 25 AM

We register a new task to log every 5 minute (if Fleet log level is debug) or 15 minutes otherwise

@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.6.0 labels Oct 26, 2022
@nchaulet
Copy link
Member Author

@elasticmachine merge upstream

@nchaulet nchaulet marked this pull request as ready for review October 31, 2022 15:07
@nchaulet nchaulet requested a review from a team as a code owner October 31, 2022 15:07
try {
const usageData = await fetchUsage();
if (appContextService.getLogger().isLevelEnabled('debug')) {
appContextService.getLogger().debug(`Feet Usage: ${JSON.stringify(usageData)}`);

Choose a reason for hiding this comment

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

typo

if (appContextService.getLogger().isLevelEnabled('debug')) {
appContextService.getLogger().debug(`Feet Usage: ${JSON.stringify(usageData)}`);
} else {
appContextService.getLogger().info(`Feet Usage: ${JSON.stringify(usageData)}`);

Choose a reason for hiding this comment

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

typo

if (!isInfoLogLevelEnabled) {
return;
}
// TODO get log level and schedule interval based on that
Copy link
Member

Choose a reason for hiding this comment

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

This todo has been addressed now, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it has been

@nchaulet nchaulet requested a review from kpollich October 31, 2022 15:23
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for typo fixes 🦶 and removing TODO 🚀

@nchaulet nchaulet enabled auto-merge (squash) October 31, 2022 15:40
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 57 63 +6
osquery 103 108 +5
securitySolution 439 443 +4
total +17

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 65 71 +6
osquery 104 110 +6
securitySolution 516 520 +4
total +18

History

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

@mikecote
Copy link
Contributor

mikecote commented Nov 2, 2022

@nchaulet Could this feature be implemented using a setInterval(...) or some other means than Task Manager? With the upcoming serverless work, we will be moving away from having tasks that aren't initiated by a user. It is important to move in that direction so we can effectively scale the background tasks processing node to 0 when users don't need it and save infrastructure costs.

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:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Add periodic logs for agent status
6 participants