Simplify redis access event format to faciliate parsing (#9046)

master
Hamid 5 years ago committed by GitHub
parent 6f66f1a910
commit 5b8975bf4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      pkg/event/target/redis.go

@ -61,6 +61,12 @@ type RedisArgs struct {
QueueLimit uint64 `json:"queueLimit"` QueueLimit uint64 `json:"queueLimit"`
} }
// RedisAccessEvent holds event log data and timestamp
type RedisAccessEvent struct {
Event []event.Event
EventTime string
}
// Validate RedisArgs fields // Validate RedisArgs fields
func (r RedisArgs) Validate() error { func (r RedisArgs) Validate() error {
if !r.Enable { if !r.Enable {
@ -185,7 +191,7 @@ func (target *RedisTarget) send(eventData event.Event) error {
} }
if target.args.Format == event.AccessFormat { 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 { if err != nil {
return err return err
} }

Loading…
Cancel
Save