mirror of
https://github.com/minio/minio.git
synced 2025-01-27 06:33:18 -05:00
Event Notification for ElasticSearch (#6764)
Using access format for Event Notification for Elastic Search
This commit is contained in:
parent
bdea19b583
commit
572719872d
@ -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…
x
Reference in New Issue
Block a user