hartfordfive / cloudflarebeat

ELK beat to fetch Cloudflare logs via the Enterprise Log Share API
Other
11 stars 8 forks source link

startTimestamp & endTimestamp sometimes returned as int64 causing interface conversion error #4

Closed hartfordfive closed 7 years ago

hartfordfive commented 8 years ago

For example, in some cases, the "cache" object is found to have startTimestamp and endTimestamp as int64 values instead of float64, which causes a panic :

  "cache": {
    "bckType": "byc",
    "cacheExternalIp": "172.68.65.143",
    "cacheExternalPort": 14949,
    "cacheFileKey": null,
    "cacheInternalIp": "10.16.10.140",
    "cacheServerName": "16c21",
    "cacheStatus": "unknown",
    "cacheTokens": 0,
    "endTimestamp": 1479096904397,
    "startTimestamp": 1479096904198
  }

Resulting panic:

goroutine 1 [running]:
panic(0x5b9980, 0xc4204aee40)
    /usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:500 +0x1a1
github.com/hartfordfive/cloudflarebeat/cloudflare.(*CloudflareClient).doRequest(0xc420330320, 0x6726e4, 0x18, 0xc420626180, 0xc420531b40, 0xe4cb, 0x990a90, 0xc4204b0048, 0xc420531bb8)
    /usr/local/go/src/github.com/hartfordfive/cloudflarebeat/cloudflare/client.go:163 +0x1265
github.com/hartfordfive/cloudflarebeat/cloudflare.(*CloudflareClient).GetLogRangeFromTimestamp(0xc420330320, 0xc420626180, 0xc420531c38, 0xc420531c28, 0xc4204b0048, 0x0, 0x0)
    /usr/local/go/src/github.com/hartfordfive/cloudflarebeat/cloudflare/client.go:201 +0x4a
github.com/hartfordfive/cloudflarebeat/beater.(*Cloudflarebeat).Run(0xc420226210, 0xc4201e4000, 0xc4201e40a8, 0xb)
    /usr/local/go/src/github.com/hartfordfive/cloudflarebeat/beater/cloudflarebeat.go:103 +0x654
github.com/hartfordfive/cloudflarebeat/vendor/github.com/elastic/beats/libbeat/beat.(*Beat).launch(0xc4201e4000, 0x6b5bf0, 0x0, 0x0)
    /usr/local/go/src/github.com/hartfordfive/cloudflarebeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:208 +0x687
github.com/hartfordfive/cloudflarebeat/vendor/github.com/elastic/beats/libbeat/beat.Run(0x66ace4, 0xe, 0x0, 0x0, 0x6b5bf0, 0xe99ce, 0xc4200001a0)
    /usr/local/go/src/github.com/hartfordfive/cloudflarebeat/vendor/github.com/elastic/beats/libbeat/beat/beat.go:133 +0x65