From d40e470a0e12e2d206d87f1ebb39e6743f880815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Fri, 31 Jan 2020 16:57:09 +0100 Subject: [PATCH 1/3] make field names a bit more specific to functionbeat to aviod collisions --- x-pack/functionbeat/provider/gcp/gcp/transformer.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/functionbeat/provider/gcp/gcp/transformer.go b/x-pack/functionbeat/provider/gcp/gcp/transformer.go index 7518414ec20..84ff3274ad4 100644 --- a/x-pack/functionbeat/provider/gcp/gcp/transformer.go +++ b/x-pack/functionbeat/provider/gcp/gcp/transformer.go @@ -33,7 +33,7 @@ func transformPubSub(mData *metadata.Metadata, msg pubsub.Message) (beat.Event, "message": string(msg.Data), "attributes": msg.Attributes, "id": mData.EventID, - "resource": common.MapStr{ + "pubsub_resource": common.MapStr{ "service": mData.Resource.Service, "name": mData.Resource.Name, "event_type": mData.Resource.Type, @@ -50,17 +50,17 @@ func transformStorage(mData *metadata.Metadata, evt StorageEvent) (beat.Event, e Fields: common.MapStr{ "read_timestamp": time.Now(), "id": mData.EventID, - "resource": common.MapStr{ + "storage_resource": common.MapStr{ "service": mData.Resource.Service, "name": mData.Resource.Name, "event_type": mData.Resource.Type, "state": evt.ResourceState, }, - "bucket": evt.Bucket, - "file": evt.Name, + "storage_bucket": evt.Bucket, + "file_name": evt.Name, "metageneration": evt.Metageneration, - "updated": evt.Updated, - "created": evt.Created, + "update_time": evt.Updated, + "create_time": evt.Created, }, }, nil } From 731e479cc28677a43b389690f4aeb4c557f87fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 3 Feb 2020 09:46:52 +0100 Subject: [PATCH 2/3] align with ECS --- .../functionbeat/provider/gcp/gcp/transformer.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/x-pack/functionbeat/provider/gcp/gcp/transformer.go b/x-pack/functionbeat/provider/gcp/gcp/transformer.go index 84ff3274ad4..9072597de51 100644 --- a/x-pack/functionbeat/provider/gcp/gcp/transformer.go +++ b/x-pack/functionbeat/provider/gcp/gcp/transformer.go @@ -33,7 +33,7 @@ func transformPubSub(mData *metadata.Metadata, msg pubsub.Message) (beat.Event, "message": string(msg.Data), "attributes": msg.Attributes, "id": mData.EventID, - "pubsub_resource": common.MapStr{ + "resource": common.MapStr{ "service": mData.Resource.Service, "name": mData.Resource.Name, "event_type": mData.Resource.Type, @@ -50,17 +50,20 @@ func transformStorage(mData *metadata.Metadata, evt StorageEvent) (beat.Event, e Fields: common.MapStr{ "read_timestamp": time.Now(), "id": mData.EventID, - "storage_resource": common.MapStr{ + "resource": common.MapStr{ "service": mData.Resource.Service, "name": mData.Resource.Name, "event_type": mData.Resource.Type, "state": evt.ResourceState, }, "storage_bucket": evt.Bucket, - "file_name": evt.Name, - "metageneration": evt.Metageneration, - "update_time": evt.Updated, - "create_time": evt.Created, + "file": common.MapStr{ + "name": evt.Name, + "mtime": evt.Updated, + "ctime": evt.Updated, + "created": evt.Created, + }, + "meta-generation": evt.Metageneration, }, }, nil } From ffb56240ef66d2453fcadf88c7efcb46c8872f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Mon, 3 Feb 2020 13:49:54 +0100 Subject: [PATCH 3/3] fix pkg builder target --- x-pack/functionbeat/magefile.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/functionbeat/magefile.go b/x-pack/functionbeat/magefile.go index 89e497d0f4f..44e9765e397 100644 --- a/x-pack/functionbeat/magefile.go +++ b/x-pack/functionbeat/magefile.go @@ -161,10 +161,7 @@ func GoTestUnit() { func BuildPkgForFunctions() error { mg.Deps(Update, Build) - err := os.MkdirAll("pkg", 700) - if err != nil { - return err - } + err := os.RemoveAll("pkg") filesToCopy := map[string]string{ filepath.Join("provider", "aws", "functionbeat-aws"): filepath.Join("pkg", "functionbeat-aws"),