What is audit logging in Google Cloud Platform (GCP)?
Audit logging in GCP records who did what, where, and when in your cloud environment. It helps track user actions and system events for security and compliance.
Click to reveal answer
beginner
Name the three types of audit logs in GCP.
The three types are: Admin Activity logs (record management actions), Data Access logs (record data read/write), and System Event logs (record system operations).
Click to reveal answer
intermediate
How do you enable Data Access audit logs in GCP?
Data Access logs are disabled by default. You enable them by configuring the audit log settings in the IAM & Admin section for the specific service or project.
Click to reveal answer
beginner
Where are GCP audit logs stored and how can you view them?
Audit logs are stored in Cloud Logging. You can view them in the Logs Explorer in the Google Cloud Console or export them to BigQuery, Cloud Storage, or Pub/Sub.
Click to reveal answer
beginner
Why is audit logging important for security and compliance?
Audit logging helps detect unauthorized access, investigate incidents, and prove compliance with regulations by providing a clear record of all actions in your cloud environment.
Click to reveal answer
Which type of audit log records management actions in GCP?
AError logs
BAdmin Activity logs
CSystem Event logs
DData Access logs
✗ Incorrect
Admin Activity logs record management or administrative actions performed on resources.
Where can you view audit logs in GCP?
ACloud Shell terminal
BCloud Storage browser
CCloud Functions dashboard
DCloud Logging Logs Explorer
✗ Incorrect
Audit logs are viewed in Cloud Logging using the Logs Explorer.
By default, which audit logs are enabled in GCP?
AAdmin Activity logs
BData Access logs
CSystem Event logs
DAll audit logs
✗ Incorrect
Admin Activity logs are enabled by default; Data Access logs and System Event logs are disabled by default.
What is a common use of audit logs in cloud security?
AIncrease storage capacity
BImprove network speed
CDetect unauthorized access
DDeploy new services
✗ Incorrect
Audit logs help detect unauthorized access by recording user actions.
Which service can audit logs be exported to for advanced analysis?
ABigQuery
BCloud Run
CCloud DNS
DCloud Build
✗ Incorrect
Audit logs can be exported to BigQuery for detailed querying and analysis.
Explain what audit logging is in GCP and why it is important.
Think about how keeping a record of actions helps protect your cloud resources.
You got /3 concepts.
Describe the three types of audit logs in GCP and what each records.
Consider management actions, data operations, and system events separately.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of audit logging in Google Cloud Platform?
easy
A. To create virtual machines
B. To record actions for security and troubleshooting
C. To speed up network traffic
D. To increase storage capacity automatically
Solution
Step 1: Understand audit logging function
Audit logging captures user and system actions in your cloud environment.
Step 2: Identify the purpose
This helps with security monitoring and troubleshooting issues.
Final Answer:
To record actions for security and troubleshooting -> Option B
Quick Check:
Audit logging = record actions [OK]
Hint: Audit logs track actions for security and fixes [OK]
Common Mistakes:
Confusing audit logs with storage or network features
Thinking audit logs create resources
Assuming audit logs improve performance
2. Which command correctly creates a sink to export audit logs to a Cloud Storage bucket named my-logs-bucket?
easy
A. gcloud logging sinks create my-sink storage.googleapis.com/my-logs-bucket --log-filter="resource.type=\"gce_instance\""
B. gcloud logging create sink my-sink storage://my-logs-bucket
C. gcloud logs create sink my-sink gs://my-logs-bucket
D. gcloud logging sinks add my-sink storage.googleapis.com/my-logs-bucket
Solution
Step 1: Identify correct gcloud command syntax
The correct command uses gcloud logging sinks create followed by sink name and destination URL.
Step 2: Verify destination format
Cloud Storage buckets use storage.googleapis.com/BUCKET_NAME format.
Final Answer:
gcloud logging sinks create my-sink storage.googleapis.com/my-logs-bucket --log-filter="resource.type=\"gce_instance\"" -> Option A
Hint: Use 'gcloud logging sinks create' with full storage URL [OK]
Common Mistakes:
Using wrong command verbs like 'create sink' or 'add sink'
Incorrect bucket URL format (missing storage.googleapis.com)
Using 'gs://' instead of full URL
3. Given this filter in a sink configuration: resource.type="bigquery_resource" AND protoPayload.methodName="jobservice.jobcompleted", what logs will be exported?
medium
A. Only logs from Compute Engine instances
B. All error logs from Cloud Storage
C. All BigQuery job completion audit logs
D. All network traffic logs
Solution
Step 1: Analyze the resource type filter
The filter specifies resource.type="bigquery_resource", so logs relate to BigQuery.
Step 2: Analyze the method name filter
protoPayload.methodName="jobservice.jobcompleted" means only job completion events are included.
Final Answer:
All BigQuery job completion audit logs -> Option C
Hint: Filter resource and method to find exported logs [OK]
Common Mistakes:
Confusing resource types with unrelated services
Ignoring methodName filter
Assuming all logs are exported
4. You created a sink to export audit logs to a Pub/Sub topic but logs are not appearing. What is the most likely cause?
medium
A. The sink lacks permission to publish to the Pub/Sub topic
B. The sink filter is too broad and excludes all logs
C. Audit logging is disabled in the project
D. The Pub/Sub topic name is misspelled in the sink
Solution
Step 1: Check sink permissions
Sinks need permission to write to destinations like Pub/Sub topics.
Step 2: Identify common permission issue
If logs do not appear, the sink likely lacks the pubsub.publisher role on the topic.
Final Answer:
The sink lacks permission to publish to the Pub/Sub topic -> Option A
Quick Check:
Missing sink permissions = The sink lacks permission to publish to the Pub/Sub topic [OK]
Hint: Check sink destination permissions first when logs missing [OK]
Common Mistakes:
Assuming audit logging is off without checking
Blaming filter without verifying permissions
Ignoring typo in topic name
5. You want to export only admin activity audit logs for Cloud Storage buckets in your project to a BigQuery dataset for analysis. Which sink filter is correct?
hard
A. resource.type="gcs_bucket" AND severity="ERROR"
B. logName:"cloudaudit.googleapis.com/activity" AND resource.type="gcs_bucket" AND protoPayload.methodName:"storage.objects.create"
C. logName:"cloudaudit.googleapis.com/data_access" AND resource.type="gcs_bucket"
D. logName:"cloudaudit.googleapis.com/admin_activity" AND resource.type="gcs_bucket"
Solution
Step 1: Identify admin activity logs
Admin activity logs use logName:"cloudaudit.googleapis.com/admin_activity".
Step 2: Filter for Cloud Storage buckets
Use resource.type="gcs_bucket" to target storage buckets.
Step 3: Confirm filter matches requirement
logName:"cloudaudit.googleapis.com/admin_activity" AND resource.type="gcs_bucket" correctly combines admin activity logs with GCS buckets.
Final Answer:
logName:"cloudaudit.googleapis.com/admin_activity" AND resource.type="gcs_bucket" -> Option D