Skip to content

Commit f7dca71

Browse files
matteopasapoiana
authored andcommitted
add time field extract
Signed-off-by: matteopasa <matteo.pasina@sysdig.com>
1 parent 0cdc099 commit f7dca71

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/gcpaudit/pkg/gcpaudit/extract.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func (p *Plugin) Fields() []sdk.FieldEntry {
5050
{Type: "string", Name: "gcp.resourceType", Display: "Resource Type", Desc: "GCP resource type"},
5151
{Type: "string", Name: "gcp.resourceLabels", Display: "Resource Labels", Desc: "GCP resource labels"},
5252
{Type: "string", Name: "gcp.storage.bucket", Display: "Bucket Name", Desc: "GCP bucket name"},
53+
{Type: "string", Name: "gcp.time", Display: "Timestamp of the event", Desc: "Timestamp of the event in RFC3339 format"},
5354
}
5455
}
5556

@@ -238,6 +239,11 @@ func (p *Plugin) Extract(req sdk.ExtractRequest, evt sdk.EventReader) error {
238239
req.SetValue(string(bucket))
239240
}
240241

242+
case "gcp.time":
243+
timestamp := p.jdata.GetStringBytes("timestamp")
244+
if timestamp != nil {
245+
req.SetValue(string(timestamp))
246+
}
241247
default:
242248
return fmt.Errorf("unknown field: %s", req.Field())
243249
}

0 commit comments

Comments
 (0)