Event Notification for ElasticSearch (#6764)

Using access format for Event Notification for Elastic Search
master
Ashish Kumar Sinha 6 years ago committed by kannappanr
parent bdea19b583
commit 572719872d
  1. 9
      pkg/event/target/elasticsearch.go

@ -22,7 +22,6 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"strings" "strings"
"time"
"github.com/minio/minio/pkg/event" "github.com/minio/minio/pkg/event"
xnet "github.com/minio/minio/pkg/net" xnet "github.com/minio/minio/pkg/net"
@ -85,13 +84,7 @@ func (target *ElasticsearchTarget) Send(eventData event.Event) (err error) {
} }
add := func() error { add := func() error {
eventTime, err := time.Parse(event.AMZTimeFormat, eventData.EventTime) _, err = target.client.Index().Index(target.args.Index).Type("event").BodyJson(map[string]interface{}{"Records": []event.Event{eventData}}).Do(context.Background())
if err != nil {
return err
}
eventTimeMS := fmt.Sprintf("%d", eventTime.UnixNano()/1000000)
_, err = target.client.Index().Index(target.args.Index).Type("event").Timestamp(eventTimeMS).BodyJson(map[string]interface{}{"Records": []event.Event{eventData}}).Do(context.Background())
return err return err
} }

Loading…
Cancel
Save