Skip to content

Commit 2b63496

Browse files
authored
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
1 parent 38d5f43 commit 2b63496

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.next.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
154154
- The backing off now implements jitter to better distribute the load. {issue}10172[10172]
155155
- Fix TLS certificate DoS vulnerability. {pull}10302[10302]
156156
- 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]
157+
- Fix encoding of timestamps when using disk spool. {issue}10099[10099]
157158

158159
*Auditbeat*
159160

libbeat/publisher/queue/spool/codec.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
"github.com/elastic/beats/libbeat/beat"
2626
"github.com/elastic/beats/libbeat/common"
27+
"github.com/elastic/beats/libbeat/outputs/codec"
2728
"github.com/elastic/beats/libbeat/publisher"
2829
"github.com/elastic/go-structform"
2930
"github.com/elastic/go-structform/cborl"
@@ -95,7 +96,12 @@ func (e *encoder) reset() {
9596
panic("no codec configured")
9697
}
9798

98-
folder, err := gotype.NewIterator(visitor)
99+
folder, err := gotype.NewIterator(visitor,
100+
gotype.Folders(
101+
codec.MakeTimestampEncoder(),
102+
codec.MakeBCTimestampEncoder(),
103+
),
104+
)
99105
if err != nil {
100106
panic(err)
101107
}

0 commit comments

Comments
 (0)