|
|
@ -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 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|