Complete the command to enable audit logging for a GCP project.
gcloud logging [1] create --project=my-projectThe gcloud logging sinks create command is used to create a sink, which can be used to export audit logs.
Complete the command to list audit logs in GCP.
gcloud logging [1] list --project=my-projectThe gcloud logging entries list command lists log entries, including audit logs.
Fix the error in the command to enable audit logging for BigQuery.
gcloud logging sinks create bigquery_sink bigquery.googleapis.com/projects/my-project/datasets/my_dataset --log-filter='resource.type=[1]' --project=my-project
The correct resource type for BigQuery audit logs is bigquery_dataset.
Fill both blanks to create a filter for audit logs of admin activity on Compute Engine.
resource.type=[1] AND protoPayload.methodName=[2]
The resource type for Compute Engine instances is gce_instance. The method name for creating instances is v1.compute.instances.insert.
Fill all three blanks to create a dictionary comprehension that maps log names to their creation timestamps, filtering logs with 'admin' in their name.
{ [1]: [2] for [3] in logs if 'admin' in [3] }We use log.name as the key, log.createTime as the value, and iterate over log in logs.