From 5b8975bf4b075808adfa86454da85fa0f3673bfe Mon Sep 17 00:00:00 2001 From: Hamid Date: Wed, 26 Feb 2020 17:23:32 +0000 Subject: [PATCH] Simplify redis access event format to faciliate parsing (#9046) --- pkg/event/target/redis.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/event/target/redis.go b/pkg/event/target/redis.go index 78c22f906..979415d30 100644 --- a/pkg/event/target/redis.go +++ b/pkg/event/target/redis.go @@ -61,6 +61,12 @@ type RedisArgs struct { QueueLimit uint64 `json:"queueLimit"` } +// RedisAccessEvent holds event log data and timestamp +type RedisAccessEvent struct { + Event []event.Event + EventTime string +} + // Validate RedisArgs fields func (r RedisArgs) Validate() error { if !r.Enable { @@ -185,7 +191,7 @@ func (target *RedisTarget) send(eventData event.Event) error { } if target.args.Format == event.AccessFormat { - data, err := json.Marshal([]interface{}{eventData.EventTime, []event.Event{eventData}}) + data, err := json.Marshal([]RedisAccessEvent{{Event: []event.Event{eventData}, EventTime: eventData.EventTime}}) if err != nil { return err }