From 194fa61b399bbd3a411fd2fe75bd36d079ab66c5 Mon Sep 17 00:00:00 2001 From: Steffen Siering Date: Wed, 21 Apr 2021 15:25:37 +0200 Subject: [PATCH] Cherry-pick #25051 to 7.12: Update go-structform to 0.0.8 (#25179) (cherry picked from commit fb1eb8d812002c28dd0478eb636b792d8b1abea2) --- CHANGELOG.next.asciidoc | 7 +++++++ NOTICE.txt | 8 ++++---- go.mod | 4 ++-- go.sum | 7 +++++-- libbeat/outputs/codec/json/json.go | 1 + libbeat/outputs/codec/json/json_test.go | 13 +++++++++---- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index e6de3cebfb6..c879681b0cc 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -85,6 +85,13 @@ 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] +- TLS or Beats that accept connections over TLS and validate client certificates. {pull}14146[14146] +- Fix panics that could result from invalid TLS certificates. This can affect Beats that connect over TLS, or Beats that accept connections over TLS and validate client certificates. {pull}14146[14146] +- Fix panic in the Logstash output when trying to send events to closed connection. {pull}15568[15568] - Fix a race condition with the Kafka pipeline client, it is possible that `Close()` get called before `Connect()` . {issue}11945[11945] - Allow users to configure only `cluster_uuid` setting under `monitoring` namespace. {pull}14338[14338] - Update replicaset group to apps/v1 {pull}15854[15802] diff --git a/NOTICE.txt b/NOTICE.txt index ed4f2cb3423..5978531e3c3 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 @@ -14129,11 +14129,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 e8855bce0fc..a9e6a0f5a9e 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 @@ -146,7 +146,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 7eef9ed3806..872198a6b18 100644 --- a/go.sum +++ b/go.sum @@ -265,8 +265,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= @@ -692,6 +692,9 @@ github.com/stretchr/testify v1.5.0/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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 {