From 2b634964e54fbf221e78f7dfb29ba874daf7aa98 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Tue, 5 Feb 2019 12:00:30 -0500 Subject: [PATCH] Add time encoders to disk spool (#10197) Register encoders for time.Time and common.Time so that events containing timestamps can be serialized. Fixes #10099 --- CHANGELOG.next.asciidoc | 1 + libbeat/publisher/queue/spool/codec.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a5a3c8e9831..16e5586490d 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -154,6 +154,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - The backing off now implements jitter to better distribute the load. {issue}10172[10172] - Fix TLS certificate DoS vulnerability. {pull}10302[10302] - Fix panic and file unlock in spool on atomic operation (arm, x86-32). File lock was not released when panic occurs, leading to the beat deadlocking on startup. {pull}10289[10289] +- Fix encoding of timestamps when using disk spool. {issue}10099[10099] *Auditbeat* diff --git a/libbeat/publisher/queue/spool/codec.go b/libbeat/publisher/queue/spool/codec.go index 03964c1a274..ea51e930b98 100644 --- a/libbeat/publisher/queue/spool/codec.go +++ b/libbeat/publisher/queue/spool/codec.go @@ -24,6 +24,7 @@ import ( "github.com/elastic/beats/libbeat/beat" "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/outputs/codec" "github.com/elastic/beats/libbeat/publisher" "github.com/elastic/go-structform" "github.com/elastic/go-structform/cborl" @@ -95,7 +96,12 @@ func (e *encoder) reset() { panic("no codec configured") } - folder, err := gotype.NewIterator(visitor) + folder, err := gotype.NewIterator(visitor, + gotype.Folders( + codec.MakeTimestampEncoder(), + codec.MakeBCTimestampEncoder(), + ), + ) if err != nil { panic(err) }