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

go panic error caused by IPv6 address client.ip field #17

Open
naukkuws opened this issue Apr 25, 2017 · 2 comments
Open

go panic error caused by IPv6 address client.ip field #17

naukkuws opened this issue Apr 25, 2017 · 2 comments

Comments

@naukkuws
Copy link

naukkuws commented Apr 25, 2017

I realized that when the field client.ip, of ELS Cloudflare API, is a IPv6 address, the cloudflarebeat stop working, caused by go panic error. The output of cloudflarebeat is:

2017-04-25T15:29:20-03:00 WARN Can not index event (status=400): {"type":"mapper_parsing_exception","reason":"failed to parse [client.ip]","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse ip [2603:3005:90d:2500:e4ce:e41f:3a8b:6d49], not a valid ipv4 address (4 dots)"}}
panic: interface conversion: interface {} is nil, not map[string]interface {}

And the go panic error is:

goroutine 30 [running]:
panic(0xa46160, 0xc4203d52c0)
	/opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hartfordfive/cloudflarebeat/cloudflare.BuildMapStr(0xc4204563f0, 0x6c8)
	/opt/go/packages/src/github.com/hartfordfive/cloudflarebeat/cloudflare/utils.go:171 +0x644c
github.com/hartfordfive/cloudflarebeat/cloudflare.(*LogConsumer).PrepareEvents(0xc4201d1000)
	/opt/go/packages/src/github.com/hartfordfive/cloudflarebeat/cloudflare/logconsumer.go:139 +0x65c
created by github.com/hartfordfive/cloudflarebeat/beater.(*Cloudflarebeat).DownloadAndPublish
	/opt/go/packages/src/github.com/hartfordfive/cloudflarebeat/beater/cloudflarebeat.go:142 +0xc1
@hartfordfive
Copy link
Owner

@naukkuws can you tell me which version of cloudflarebeat you're using? At first glance it seems like this error seems like a mapping error due to the index template. Elasticsearch 2.x did not support IPv6 addresses for the "ip" type. I'll probably just have to update cloudflarebeat.template-es2x.json template so that anything currently typed as "ip" is changed to "string".

@naukkuws
Copy link
Author

naukkuws commented May 5, 2017

@hartfordfive, I did the modifications you suggested, but unfortunately the problem persists. Do you have any other suggestion? Do I have to do anything else?

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

2 participants