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

Add ability to log all source hosts from http header instead of only the first one. #444

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

bubu11e
Copy link
Contributor

@bubu11e bubu11e commented Nov 28, 2023

This PR add the ability to extract all hosts from a custom header or the standard one Forwarded, X-Real-IP, X-Forwraded-For.

This list of hosts can then be used for informational purposes.

Previous behavior remains the default one and new one can be triggered by setting a configuration flag server.log-source-ips-full to true.

This PR follow this conversation.

@CLAassistant
Copy link

CLAassistant commented Nov 28, 2023

CLA assistant check
All committers have signed the CLA.

@bubu11e bubu11e force-pushed the souce_ip_full_extract branch 2 times, most recently from 7050520 to d6d94e0 Compare November 28, 2023 15:49
@bubu11e bubu11e force-pushed the souce_ip_full_extract branch 2 times, most recently from c651602 to 3e93078 Compare December 14, 2023 10:33
This test named "multiple matching entries in the header, only first used" Should test against
one header containing multiple IPs and not multiple headers containing a single IP.

Signed-off-by: julien.girard <julien.girard@ovhcloud.com>
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

LGTM with a few small changes

middleware/source_ips.go Show resolved Hide resolved
middleware/source_ips.go Outdated Show resolved Hide resolved
server/server.go Outdated Show resolved Hide resolved
middleware/source_ips_test.go Show resolved Hide resolved
…ead of only the first one

This commit add the hability to extract all hosts from a custom header or the standard one
Forwarded, X-Real-IP, X-Forwraded-For.

This list of hosts can then be used for informational purposes.

Previous behavior remains the default one and new one can be triggered by setting a configuration
flag server.log-source-ips-full to true.

Signed-off-by: julien.girard <julien.girard@ovhcloud.com>
@56quarters 56quarters merged commit f9b01fd into grafana:main Jan 26, 2024
2 checks passed
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.

None yet

3 participants