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

IPv6 addresses can't be parsed with grok's %{IPORHOST} #1973

Closed
szabolor opened this issue Oct 30, 2016 · 4 comments
Closed

IPv6 addresses can't be parsed with grok's %{IPORHOST} #1973

szabolor opened this issue Oct 30, 2016 · 4 comments
Assignees
Labels
bug unexpected problem or unintended behavior

Comments

@szabolor
Copy link

The default %{COMBINED_LOG_FORMAT} can't understand even simple IPv6 addresses:
2001:0db8:85a3:0000:0000:8a2e:0370:7334 with %{IPORHOST} becomes: "IPORHOST": [ "2001" ]

But if we use the definition from Logstash's patters IPORHOST (?:%{IP}|%{HOSTNAME}) it can match the whole IPv6 address.

Furthermore with the definition above it still can't match IPv4-compatible addresses, like ::ffff:192.0.2.128, but that can be solved by replacing "listen [::]:80 ipv6only=off;" with "listen 80; listen [::]:80 ipv6only=on;" at nginx's server config.

Telegraf - version 1.0.1

@sparrc sparrc added the bug unexpected problem or unintended behavior label Nov 2, 2016
@sparrc sparrc added this to the 1.2.0 milestone Nov 2, 2016
@sparrc
Copy link
Contributor

sparrc commented Dec 20, 2016

the grok library that we use to parse patterns appears to have an issue with the IPORHOST pattern. I'm not sure why exactly, but might have something to do with the number of levels of that particular pattern (see vjeantet/grok#17)

I'll have a fix for the CLF pattern up shortly, though I'll leave this case open because using IPORHOST (and probably other valid grok patterns) is still broken.

@sparrc sparrc modified the milestones: Future Milestone, 1.2.0, 1.3.0 Dec 20, 2016
sparrc added a commit that referenced this issue Dec 20, 2016
njwhite pushed a commit to njwhite/telegraf that referenced this issue Jan 31, 2017
@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2017

pushing this out because it's dependent on vjeantet/grok#17

@sparrc sparrc modified the milestones: Future Milestone, 1.3.0 Feb 22, 2017
@danielnelson danielnelson removed this from the Future Milestone milestone Jun 14, 2017
maxunt pushed a commit that referenced this issue Jun 26, 2018
@maxunt maxunt self-assigned this Jun 27, 2018
@maxunt
Copy link
Contributor

maxunt commented Jun 27, 2018

grok %{COMBINED_LOG_FORMAT} as well as %{IPORHOST} work as they should. %{IPORHOST} also now supports IPV6 addresses

@maxunt maxunt closed this as completed Jun 27, 2018
@russorat russorat reopened this Jul 9, 2018
@maxunt
Copy link
Contributor

maxunt commented Jul 9, 2018

a functional test case can be found for working IPV6 addresses in telegraf/plugins/inputs/logparser/grok/grok_test.go on line 123

@maxunt maxunt closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

5 participants