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

Adding extra fields to access logging #2414

Closed
wants to merge 1 commit into from

Conversation

neoreddog
Copy link

@neoreddog neoreddog commented May 30, 2023

Problem:

Observing network traffic with Linkerd is a step-backwards from Istio as fields like ‘x-forwarded-from’ are missing from the access logs. This makes it difficult to identify where a request comes from.

As partly described in Issue #9842 linkerd/linkerd2#9842.

Access logs also lack a path and query field and instead provide only the entire uri, again a QOL problem that makes it harder to adopt Linkerd.

Solution:

Adding in three fields,

x_forwarded_for
requested_server_name
path

The first two fields are extracted from the request headers using the pre-existing get-header method.

The path field is extracted from the request.uri().path_and_query() method and defaults to "" if no path can be extracted from the uri.

Validation:

Building and deploying the customised linkerd proxy with access logs enabled alongside a nginx container.

Sending network requests and validating that all pre-existing fields persist and the new ones function as intended.

Fixes:

Part fixes #9842

I agree to the DCO for all the commits in this PR.

Linkerd access logs are missing some useful information that's already accessible from the request headers.

Solved by adding in three additional fields, x_forwarded_for, requested_server_name and path

Validated by compiling and deploying the modified proxy image alongside a nginx container, checking access log content for existing fields + new ones

Part fixes issue #9842
@neoreddog
Copy link
Author

While working I don't think the current implementation is ideal. Hardcoding the x-envoy-decorator-operation header is only applicable when using an envoy proxy and isn't part of an RFC.

I'd like to work on this more and look at adding runtime args or a configuration option to include custom headers, then it'd be more useful to the community as a whole.

Is there a preference for any specific method?

  • Runtime args
  • Env var
  • Config option

@neoreddog neoreddog closed this Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant