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

nginx parser does not capture multiple entries in http_x_forwarded_for-header when it contains white-spaces #3420

Closed
mkoertgen opened this issue Jun 11, 2021 · 3 comments

Comments

@mkoertgen
Copy link

Check CONTRIBUTING guideline first and here is the list to help us investigate the problem.

Describe the bug

The X-Forwarded-For allows a list of forwards which may include whitespace, e.g. client, proxy1, proxy2
The current regexp in the nginx-parser does not capture that.

To Reproduce

Have an nginx log with multiple proxies and the log will not be captured.

Check with fluentular:

Expected behavior
The above log line can be captured

Your Environment

docker image: fluent/fluentd-kubernetes-daemonset:v1.12.3-debian-elasticsearch7-1.0

@mkoertgen
Copy link
Author

A slight modification of the regexp would help:

^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)"(?:\s+"(?<http_x_forwarded_for>[^\"]+)")?)?$

This captures an optional forward-for-header enclosed by quotes.

@mkoertgen
Copy link
Author

mkoertgen commented Jun 11, 2021

Seems to be addressed in v1.13.0 with #2171

@mkoertgen
Copy link
Author

Waiting for docker image for 1.13.0 to become available, cf.:

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

No branches or pull requests

1 participant