Set up log delivery for a cloud storage bucket.

0 votes
How to set up logs delivery for a cloud storage bucket. How can I do this using JSON API?
Nov 22 in GCP by anonymous
• 6,650 points
28 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 by Sirajul
• 40,980 points

Related Questions In GCP

0 votes
1 answer
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 23 in GCP by Sirajul
• 40,980 points
28 views
0 votes
1 answer

GCP Error: 403: Access Denied

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

answered Oct 9 in GCP by Sirajul
• 40,980 points
30 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 in GCP by Sirajul
• 40,980 points
87 views
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 21 in GCP by Sirajul
• 40,980 points
9 views