From fb1eb8d812002c28dd0478eb636b792d8b1abea2 Mon Sep 17 00:00:00 2001 From: Steffen Siering Date: Thu, 15 Apr 2021 01:12:25 +0200 Subject: [PATCH] Update go-structform to 0.0.8 (#25051) --- CHANGELOG.next.asciidoc | 1 + NOTICE.txt | 8 ++++---- go.mod | 4 ++-- go.sum | 6 ++++-- libbeat/outputs/codec/json/json.go | 1 + libbeat/outputs/codec/json/json_test.go | 13 +++++++++---- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 6056c537540..4c2d1a4e048 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -161,6 +161,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d *Affecting all Beats* +- Fix events being dropped if they contain a floating point value of NaN or Inf. {pull}25051[25051] - Fix templates being overwritten if there was an error when check for the template existance. {pull}24332[24332] - Fix Kubernetes autodiscovery provider to correctly handle pod states and avoid missing event data {pull}17223[17223] - Fix `add_cloud_metadata` to better support modifying sub-fields with other processors. {pull}13808[13808] diff --git a/NOTICE.txt b/NOTICE.txt index 8f8c34c3f32..78056a21acd 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -7454,11 +7454,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-seccomp-bpf@ -------------------------------------------------------------------------------- Dependency : github.com/elastic/go-structform -Version: v0.0.7 +Version: v0.0.8 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/go-structform@v0.0.7/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/go-structform@v0.0.8/LICENSE: Apache License Version 2.0, January 2004 @@ -14556,11 +14556,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- Dependency : github.com/stretchr/testify -Version: v1.6.1 +Version: v1.7.0 Licence type (autodetected): MIT -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/stretchr/testify@v1.6.1/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/stretchr/testify@v1.7.0/LICENSE: MIT License diff --git a/go.mod b/go.mod index b5beed2f436..72e071aea01 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/elastic/go-lumber v0.1.0 github.com/elastic/go-perf v0.0.0-20191212140718-9c656876f595 github.com/elastic/go-seccomp-bpf v1.1.0 - github.com/elastic/go-structform v0.0.7 + github.com/elastic/go-structform v0.0.8 github.com/elastic/go-sysinfo v1.6.0 github.com/elastic/go-txfile v0.0.7 github.com/elastic/go-ucfg v0.8.3 @@ -147,7 +147,7 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.6.1 + github.com/stretchr/testify v1.7.0 github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b github.com/tsg/gopacket v0.0.0-20200626092518-2ab8e397a786 github.com/ugorji/go/codec v1.1.8 diff --git a/go.sum b/go.sum index febd82c91b3..ee234fb91d8 100644 --- a/go.sum +++ b/go.sum @@ -296,8 +296,8 @@ github.com/elastic/go-plugins-helpers v0.0.0-20200207104224-bdf17607b79f h1:Fvsq github.com/elastic/go-plugins-helpers v0.0.0-20200207104224-bdf17607b79f/go.mod h1:OPGqFNdTS34kMReS5hPFtBhD9J8itmSDurs1ix2wx7c= github.com/elastic/go-seccomp-bpf v1.1.0 h1:jUzzDc6LyCtdolZdvL/26dad6rZ9vsc7xZ2eadKECAU= github.com/elastic/go-seccomp-bpf v1.1.0/go.mod h1:l+89Vy5BzjVcaX8USZRMOwmwwDScE+vxCFzzvQwN7T8= -github.com/elastic/go-structform v0.0.7 h1:ihszOJQryNuIIHE2ZgsbiDq+agKO6V4yK0JYAI3tjzc= -github.com/elastic/go-structform v0.0.7/go.mod h1:QrMyP3oM9Sjk92EVGLgRaL2lKt0Qx7ZNDRWDxB6khVs= +github.com/elastic/go-structform v0.0.8 h1:U0qnb9Zqig7w+FhF+sLI3VZPPi/+2aJ0bIEW6R1z6Tk= +github.com/elastic/go-structform v0.0.8/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4= github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-sysinfo v1.6.0 h1:u0QbU8eWSwKRPcFQancnSY4Zi0COksCJXkUgPHxE5Tw= github.com/elastic/go-sysinfo v1.6.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= @@ -768,6 +768,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 h1:zLV6q4e8Jv9EHjNg/iHfzwDkCve6Ua5jCygptrtXHvI= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b h1:X/8hkb4rQq3+QuOxpJK7gWmAXmZucF0EI1s1BfBLq6U= github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b/go.mod h1:jAqhj/JBVC1PwcLTWd6rjQyGyItxxrhpiBl8LSuAGmw= diff --git a/libbeat/outputs/codec/json/json.go b/libbeat/outputs/codec/json/json.go index 01d4f324104..15f28aa3388 100644 --- a/libbeat/outputs/codec/json/json.go +++ b/libbeat/outputs/codec/json/json.go @@ -73,6 +73,7 @@ func New(version string, config Config) *Encoder { func (e *Encoder) reset() { visitor := json.NewVisitor(&e.buf) visitor.SetEscapeHTML(e.config.EscapeHTML) + visitor.SetIgnoreInvalidFloat(true) var err error diff --git a/libbeat/outputs/codec/json/json_test.go b/libbeat/outputs/codec/json/json_test.go index be2381e38c4..18a1903abe8 100644 --- a/libbeat/outputs/codec/json/json_test.go +++ b/libbeat/outputs/codec/json/json_test.go @@ -18,6 +18,7 @@ package json import ( + "math" "testing" "time" @@ -52,27 +53,31 @@ func TestJsonCodec(t *testing.T) { "msg": "message" }`, }, - "html escaping enabled": testCase{ + "html escaping enabled": { config: Config{EscapeHTML: true}, in: common.MapStr{"msg": "world"}, expected: `{"@timestamp":"0001-01-01T00:00:00.000Z","@metadata":{"beat":"test","type":"_doc","version":"1.2.3"},"msg":"\u003chello\u003eworld\u003c/hello\u003e"}`, }, - "html escaping disabled": testCase{ + "html escaping disabled": { config: Config{EscapeHTML: false}, in: common.MapStr{"msg": "world"}, expected: `{"@timestamp":"0001-01-01T00:00:00.000Z","@metadata":{"beat":"test","type":"_doc","version":"1.2.3"},"msg":"world"}`, }, - "UTC timezone offset": testCase{ + "UTC timezone offset": { config: Config{LocalTime: true}, in: common.MapStr{"msg": "message"}, expected: `{"@timestamp":"0001-01-01T00:00:00.000+00:00","@metadata":{"beat":"test","type":"_doc","version":"1.2.3"},"msg":"message"}`, }, - "PST timezone offset": testCase{ + "PST timezone offset": { config: Config{LocalTime: true}, ts: time.Time{}.In(time.FixedZone("PST", -8*60*60)), in: common.MapStr{"msg": "message"}, expected: `{"@timestamp":"0000-12-31T16:00:00.000-08:00","@metadata":{"beat":"test","type":"_doc","version":"1.2.3"},"msg":"message"}`, }, + "float undefined values": { + in: common.MapStr{"nan": math.NaN()}, + expected: `{"@timestamp":"0001-01-01T00:00:00.000Z","@metadata":{"beat":"test","type":"_doc","version":"1.2.3"},"nan":null}`, + }, } for name, test := range cases {