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

added http-x-forwarded-for field to nginx parser #1912

Closed
wants to merge 3 commits into from

Conversation

yaron-idan
Copy link
Contributor

Closing #1907, an update to the docs has been proposed in fluent/fluentd-docs#471.

@@ -24,23 +25,23 @@ def create_driver

def test_parse
d = create_driver
d.instance.parse('127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777 "-" "Opera/12.0"') { |time, record|
d.instance.parse('127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777 "-" "Opera/12.0" -') { |time, record|
Copy link
Member

Choose a reason for hiding this comment

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

Don't change existing test because it is needed to check compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, this test will fail though if it won't be adapted to the nginx log format, how are you suggesting to overcome this issue? Create another test with the new format?

Copy link
Member

@repeatedly repeatedly Mar 30, 2018

Choose a reason for hiding this comment

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

Create another test

Yes, creating new test is needed. Many users use nginx format so we can't break it. changing behaviour breaks user environment and causes log lost.

the new format?

One regular expression seems to support both with/without http_x_forwarded_for logs.

@yaron-idan
Copy link
Contributor Author

I've fixed the REGEXP to make the new field optional. I've also heed the advice of an SO answer and swapped [^ ] with \S which seems more readable to me - but I can change back if you don't agree.
All existing tests pass fine, and a new test has been added to check compatibility with the extended log entry. Hope that fits the requested changes.

@repeatedly
Copy link
Member

[^ ] and \S are different and \S is bit slower. Please back changes to previous implementation.
In addition, we enabled DCO for our repository. Please add your sign to the commit. See https://github.com/apps/dco

Signed-off-by: yaron-idan <[email protected]>
@yaron-idan
Copy link
Contributor Author

OK, seems I'm gonna have to open a new PR since DCO rejects commits without a sign off, I'm gonna close this one and open a new one with the changes requested + a sign off.

@yaron-idan yaron-idan closed this Apr 6, 2018
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.

2 participants