Set up log delivery for a cloud storage bucket

+1 vote
How to set up logs delivery for a cloud storage bucket. How can I do this using JSON API?
Nov 22, 2019 in GCP by anonymous
• 19,610 points
1,050 views

1 answer to this question.

0 votes

The following steps describe how to set up logs delivery for a specific bucket using the JSON API.

  1. Create a bucket to store your logs.

    Create a bucket to store your logs using the following request:

    POST /storage/v1/b?project=project-id
    Host: storage.googleapis.com
    
    {
      "name": "example-logs-bucket"
    }
    
  2. Set permissions to allow Cloud Storage WRITE permission to the bucket. To grant Cloud Storage WRITE access to your bucket, add an ACL entry for the bucket that grants the cloud-storage-analytics@google.com group write access. You can do this with the following request to the BucketAccessControls resource for the logging bucket:

    POST /storage/v1/b/example-logs-bucket/acl
    Host: storage.googleapis.com
    {
     "entity": "group-cloud-storage-analytics@google.com",
     "role": "WRITER"
    }
    
  3. Enable logging for your bucket. You can enable logging for your bucket using the following request:

    PATCH /storage/v1/b/example-bucket
    Host: storage.googleapis.com
    
    {
     "logging": {
      "logBucket": "example-logs-bucket",
      "logObjectPrefix": "log_object_prefix"
     }
    }
answered Nov 22, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer

Mounting a Google cloud storage bucket to a GKE pod as a persistent disk.

Yes, its possible. There's a similar project,follow ...READ MORE

answered Oct 16, 2019 in GCP by Sirajul
• 59,230 points
9,944 views
0 votes
1 answer
0 votes
1 answer

How to create a cloud storage bucket in GCP?

Buckets are the basic containers that hold your ...READ MORE

answered Oct 24, 2019 in GCP by Sirajul
• 59,230 points
2,714 views
0 votes
1 answer

GCP Error: 403: Access Denied

Check that your credentials are correct. For ...READ MORE

answered Oct 9, 2019 in GCP by Sirajul
• 59,230 points
4,002 views
0 votes
1 answer

Permissions issue with Google Cloud Storage Bucket.

You can regain access to the object by assigning an applicable role, like roles/storage.objectAdmin, to ...READ MORE

answered Oct 10, 2019 in GCP by Sirajul
• 59,230 points
4,935 views
0 votes
1 answer
0 votes
1 answer

How to set up and use Pub/Sub Notifications for Cloud Storage?

The following steps add a notification configuration to your ...READ MORE

answered Nov 22, 2019 in GCP by Sirajul
• 59,230 points
2,289 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP