Fix log level value reported by Agent to Fleet#4838
Conversation
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
|
|
||
| if ecsMeta.Elastic == nil || ecsMeta.Elastic.Agent == nil { | ||
| // escMeta struct is incomplete: log a warning | ||
| f.log.Warnw("Agent ECSMetadata struct is missing/incomplete", "elastic_ecs_metadata", ecsMeta.Elastic) |
There was a problem hiding this comment.
can't this become a bit chatty in case ecs metadata is in fact incomplete?
There was a problem hiding this comment.
It can, the fact is that the current implementation of AgentInfo.ECSMetadata() guarantees that those structures exist but they are pointers so I would like to avoid a segmentation fault when something changes...
Maybe I can replace that with a unit test + assertion that AgentInfo.ECSMetadata() always returns initialized Elastic and Elastic.Agent pointers
There was a problem hiding this comment.
removed in 4973844 in favor of assertions on ECSMetadata() unit tests
blakerouse
left a comment
There was a problem hiding this comment.
Basically a 1 line change, with lots of tests!
Looks good.
|
buildkite test it |
2657ada to
75403ca
Compare
|
…ic#4838)" (elastic#4938)" This reverts commit 2b2e8d0.




What does this PR do?
This PR fixes the log level reported by Agent when checking in with Fleet.
Since merging #3090, a managed elastic-agent has now 2 sources of configuration for log level:
fleet.encBefore this change, the agent was sending only the information coming from 1. (with a default value equal to
info), now we send back to Fleet the actual log level specified in coordinator state (which is the end result of evaluating the multiple settings with the correct priority)There has also been a modification of the integration test related to the feature with additional assertions on log level received by Fleet.
Why is it important?
The log level is now correctly displayed in Fleet UI regardless for each agent, regardless of how it's been set (agent settings, policy or default value)
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in./changelog/fragmentsusing the changelog toolDisruptive User Impact
How to test this PR locally
Advanced settingsunder the Policy'ssettingsTabinfoofflinestate in the image below, the screenshot was taken after the agent has been uninstalled)Related issues
log_levelmetadata is not accurate #4747Questions to ask yourself