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

[All beats] HTTP request should include the beat name and the version as part of the user-agent #18160

Closed
archon810 opened this issue May 3, 2020 · 6 comments · Fixed by #27509
Assignees
Labels
enhancement Team:Elastic-Agent Label for the Agent team

Comments

@archon810
Copy link

This is a follow-up to #10170, but for all beats, not just Heartbeat.

Specifically, Metricbeat in my case (I haven't checked the others).

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 3, 2020
@andresrc andresrc added the Team:Services (Deprecated) Label for the former Integrations-Services team label May 4, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2020
@kvch kvch added good first issue Indicates a good issue for first-time contributors and removed good first issue Indicates a good issue for first-time contributors labels May 4, 2020
@ph
Copy link
Contributor

ph commented May 7, 2020

For the person doing the implementation, its matter of auditing all the HTTP we are using in the beats and add a round tripper to the http client. You could reuse the code in

type UserAgentRoundTripper struct {
rt http.RoundTripper
userAgent string
}
// RoundTrip adds a User-Agent string on every request if its not already present.
func (r *UserAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
const userAgentHeader = "User-Agent"
if len(req.Header.Get(userAgentHeader)) == 0 {
req.Header.Set(userAgentHeader, r.userAgent)
}
return r.rt.RoundTrip(req)
}

@botelastic
Copy link

botelastic bot commented Apr 7, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added the Stalled label Apr 7, 2021
@archon810
Copy link
Author

Bump.

@botelastic botelastic bot removed the Stalled label Apr 7, 2021
@wasserman
Copy link

wasserman commented Apr 20, 2021

It helpful to include the beat's hostname and/or IP in this User-Agent string. I am thinking of scenarios where there is a beat failing to authenticate to the cluster and it is hitting the cloud through a corporate proxy. All beats may appear to come from the same IP, which makes identifying the problem beat challenging. Adding hostname/IP could make it easier for the team that focusing on the Elastic stack in an organization to identify the source host.
This would allow auth or apikey failures to have an audit trail when a load-balancer is logging the User-Agent string. Maybe even available in Elastic logs if this is support and can be switched on log4j.

@ph ph added Team:Elastic-Agent Label for the Agent team and removed Team:Services (Deprecated) Label for the former Integrations-Services team [zube]: Team Triage labels Apr 30, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants