Skip to content

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

Description

@naukkuws

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions