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

[Elastic Agent] Use Fleet agent ID as agent.id #26394

Merged
merged 1 commit into from Jun 22, 2021

Conversation

andrewkroh
Copy link
Member

What does this PR do?

This updates the inject_agent_info rule to set the agent.id field to the value of the Fleet Agent ID.
Previously this value was only added to the elastic_agent.id field, and the agent.id field was
a random UUID generated the first time a Beat process was run. And each Beat process would
have its own UUID.

This change affects metricbeat, filebeat, heartbeat, osquerybeat, and packetbeat (these are the
Beats that have an integration with Agent today). Heartbeat's Agent spec was missing the
inject_agent_info so I added it.

Closes #21121

Why is it important?

The agent.id of the running processes to match what we show to users in the Fleet UI.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jun 21, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 21, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #26394 updated

  • Start Time: 2021-06-21T18:03:39.844+0000

  • Duration: 78 min 54 sec

  • Commit: 313cd53

Test stats 🧪

Test Results
Failed 0
Passed 6924
Skipped 16
Total 6940

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 6924
Skipped 16
Total 6940

This updates the inject_agent_info rule to set the `agent.id` field to the value of the Fleet Agent ID.
Previously this value was only added to the `elastic_agent.id` field, and the `agent.id` field was
a random UUID generated the first time a Beat process was run. And each Beat process would
have its own UUID.

This change affects metricbeat, filebeat, heartbeat, osquerybeat, and packetbeat (these are the
Beats that have an integration with Agent today). Heartbeat's Agent spec was missing the
`inject_agent_info` so I added it.

Closes elastic#21121
@andrewkroh andrewkroh requested review from ph and blakerouse June 21, 2021 19:24
@andrewkroh andrewkroh added the backport-v7.14.0 Automated backport with mergify label Jun 21, 2021
@ph ph requested a review from michalpristas June 21, 2021 19:45
@ph
Copy link
Contributor

ph commented Jun 21, 2021

@michalpristas Can you take a look at this PR, I think the strategy but I think you have a better understanding of the impact of changes in the area of the code.

Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

the change is backward compatible and preserves elastic_agent.id|version|snapshot
having same ID should be ok as the way of collecting event is an implementation detail.

@andrewkroh andrewkroh merged commit bb950bf into elastic:master Jun 22, 2021
mergify bot pushed a commit that referenced this pull request Jun 22, 2021
This updates the inject_agent_info rule to set the `agent.id` field to the value of the Fleet Agent ID.
Previously this value was only added to the `elastic_agent.id` field, and the `agent.id` field was
a random UUID generated the first time a Beat process was run. And each Beat process would
have its own UUID.

This change affects metricbeat, filebeat, heartbeat, osquerybeat, and packetbeat (these are the
Beats that have an integration with Agent today). Heartbeat's Agent spec was missing the
`inject_agent_info` so I added it.

Closes #21121

(cherry picked from commit bb950bf)
andrewkroh added a commit that referenced this pull request Jun 22, 2021
This updates the inject_agent_info rule to set the `agent.id` field to the value of the Fleet Agent ID.
Previously this value was only added to the `elastic_agent.id` field, and the `agent.id` field was
a random UUID generated the first time a Beat process was run. And each Beat process would
have its own UUID.

This change affects metricbeat, filebeat, heartbeat, osquerybeat, and packetbeat (these are the
Beats that have an integration with Agent today). Heartbeat's Agent spec was missing the
`inject_agent_info` so I added it.

Closes #21121

(cherry picked from commit bb950bf)

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
andrewkroh added a commit to andrewkroh/beats that referenced this pull request Jun 28, 2021
This is a follow up to elastic#26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates elastic#26394
andrewkroh added a commit that referenced this pull request Jun 29, 2021
This is a follow up to #26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates #26394
mergify bot pushed a commit that referenced this pull request Jun 29, 2021
This is a follow up to #26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates #26394

(cherry picked from commit 7b66597)
andrewkroh added a commit that referenced this pull request Jun 29, 2021
…26591)

* Add Fleet agent.id to Agent monitoring data (#26548)

This is a follow up to #26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates #26394

(cherry picked from commit 7b66597)

* Fix changelog merge

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
mergify bot pushed a commit that referenced this pull request Jul 7, 2021
This is a follow up to #26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates #26394

(cherry picked from commit 7b66597)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agent backport-v7.14.0 Automated backport with mergify enhancement review Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Elastic Agent] Agent.id of running processes
4 participants