0
0
GCPcloud~20 mins

Cloud Logging overview in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cloud Logging Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary purpose of Cloud Logging in GCP?

Cloud Logging collects and stores logs from various sources in Google Cloud Platform. What is its main purpose?

ATo collect, store, and analyze logs from applications and services for monitoring and troubleshooting.
BTo provide a database service for storing structured data.
CTo deploy and manage virtual machines automatically.
DTo manage user identities and access permissions.
Attempts:
2 left
💡 Hint

Think about what logs are used for in software systems.

💻 Command Output
intermediate
2:00remaining
What is the output of this gcloud logging command?

Run the following command to list log entries for a project:

gcloud logging read "resource.type=gae_app" --limit 1 --format json

What type of output will this command produce?

AA YAML formatted list of all resources.
BA plain text list of all log names in the project.
CAn error message about missing permissions.
DA JSON array with one log entry object related to App Engine.
Attempts:
2 left
💡 Hint

The command uses --format json and --limit 1 with a filter on resource type.

Configuration
advanced
2:30remaining
Which configuration snippet correctly creates a sink to export logs to a Cloud Storage bucket?

You want to export logs from Cloud Logging to a Cloud Storage bucket named my-logs-bucket. Which YAML snippet correctly defines this sink?

A
name: my-logs-sink
destination: bigquery.googleapis.com/projects/my-project/datasets/logs
filter: "severity>=ERROR"
B
name: my-logs-sink
destination: gs://my-logs-bucket
filter: "severity>=ERROR"
C
name: my-logs-sink
destination: pubsub.googleapis.com/projects/my-project/topics/logs-topic
filter: "severity>=ERROR"
D
name: my-logs-sink
destination: storage.googleapis.com/my-logs-bucket
filter: "severity>=ERROR"
Attempts:
2 left
💡 Hint

Cloud Storage destinations use the gs:// prefix.

Troubleshoot
advanced
2:30remaining
Why does a Cloud Logging sink fail to export logs to BigQuery?

You created a sink to export logs to a BigQuery dataset, but no logs appear in the dataset. What is the most likely cause?

AThe sink filter is too broad and includes all logs.
BThe logs are not generated by any resource.
CThe sink's service account lacks BigQuery dataset write permissions.
DThe Cloud Storage bucket is not in the same region as BigQuery.
Attempts:
2 left
💡 Hint

Check permissions for the sink's service account on the destination.

🔀 Workflow
expert
3:00remaining
Order the steps to create and verify a Cloud Logging sink exporting logs to Pub/Sub

Arrange the steps in the correct order to create a sink that exports logs to a Pub/Sub topic and verify it works.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about resource creation, permission granting, and verification order.