Exam Domain 5.2 — Configure and analyse Cloud Audit Logs, export logs to SIEM, and set up monitoring alerts — is about giving yourself a reliable memory for every action that happens inside your Google Cloud environment. Without proper logging and monitoring, you would be flying blind: a breach could happen and you would never know who did what, when, or how.
Jump to a section
A simple way to picture Security Logging and Monitoring with Cloud Audit Logs and SIEM
A hotel security desk receptionist sits behind a monitor showing every door, corridor and elevator in the building. This receptionist is the Security Logging and Monitoring system for the hotel. Every time a guest swipes their keycard to enter a room, the system logs the room number, the time and the guest's name. If a guest tries to access a floor they do not have permission for, the system flags that event in red on the monitor. The receptionist does not stop the guest — that is a different job for a security guard — but they do record every attempt so management can review it later.
When the hotel manager wants to see who entered the pool area after midnight, they ask the receptionist to search the log. This is like querying Cloud Audit Logs. If the manager wants a permanent record sent to a central office for compliance reviews, the receptionist forwards a copy of the log every hour. That is like exporting logs to a SIEM (Security Information and Event Management) system.
The receptionist also has an alert rule: if any non-staff keycard enters the manager's office, a loud buzzer sounds. That is a monitoring alert. The hotel does not follow every guest around — it trusts them — but it keeps a careful record just in case something goes wrong. That is exactly how cloud security logging works: collect everything, alert on important events, and store logs where investigators can find them.
Every time you or a service does something inside Google Cloud — creating a virtual machine, deleting a storage bucket, changing a firewall rule — Google quietly writes down a record of that action. This record is called a log entry. A collection of these log entries over time is called a log. Cloud Audit Logs are the three specific types of logs that record administrative actions, data access, and policy changes inside your cloud project.
There are three kinds of Cloud Audit Logs you need to know for the PCSE exam: Admin Activity logs, Data Access logs, and System Event logs. Admin Activity logs record any action that changes a resource's configuration — for example, someone turns off a virtual machine or changes its disk size. Data Access logs record any action that reads or writes data inside a resource — for example, someone downloads a file from a storage bucket. System Event logs record automatic actions taken by Google Cloud itself, like shutting down a virtual machine due to a hardware failure.
Admin Activity logs are always enabled — you cannot turn them off. Data Access logs are turned off by default because they generate a huge volume of log entries, which costs money. You must deliberately enable Data Access logs if you want to see who accessed your data. System Event logs are always enabled as well.
Logs are stored in a Google Cloud service called Cloud Logging. Cloud Logging is a central place where all your logs — not just audit logs but also application logs and network logs — are collected and stored. You can search logs using a query language called Logging Query Language. You can also view logs in the Google Cloud Console web interface.
The problem with storing logs only in Cloud Logging is that many organisations need to keep logs for years for compliance reasons, or need to analyse logs alongside logs from other cloud providers or on-premise systems. That is where export comes in. You can set up a log sink — a configuration rule — that automatically streams copies of selected logs to another destination. The most common destinations are a Cloud Storage bucket (for long-term cheap storage), a BigQuery dataset (for SQL analysis), or a Pub/Sub topic (for streaming to security tools).
A SIEM (Security Information and Event Management) system is a specialised security tool that ingests logs from many sources — all your cloud providers, your on-premise servers, your network devices — and correlates events to find suspicious patterns. Google Cloud does not have its own built-in SIEM, but you can easily export logs to any SIEM that supports standard formats. Common SIEMs include Splunk, IBM QRadar, and Microsoft Sentinel.
Monitoring alerts are different from logging. Logging is recording what happened. Monitoring is being automatically notified when something specific happens. In Google Cloud, you use Cloud Monitoring to create alert policies. An alert policy defines a condition — for example, "more than five failed login attempts in one minute" — and an action to take when the condition is met, such as sending an email, a text message, or a webhook notification.
All of this replaces the old way of doing security monitoring, which was to have a human watch a single screen or to pay for an expensive on-premise logging appliance. Cloud logging gives you a cheap, scalable, fully managed system that works across all your cloud resources.
Enable Data Access Logs
Go to the Cloud Logging section in the Google Cloud Console and select the audit logs configuration for the specific resource (e.g., a Cloud Storage bucket or BigQuery dataset). Check the box to enable Data Access logs. This must be done per resource — it is not a project-wide toggle.
Create a Log Sink
In Cloud Logging, click on 'Log Router' and then 'Create Sink'. Give the sink a name and define a filter to include only the log types you want (e.g., Admin Activity logs from a specific project). Choose the destination: Cloud Storage for long-term cheap storage, BigQuery for SQL analysis, or Pub/Sub for streaming to a SIEM.
Set Up a Log-Based Metric
In Cloud Logging, navigate to 'Log-Based Metrics'. Click 'Create Metric'. Define a filter that matches the log entries you care about (e.g., logs containing 'iam.serviceAccounts.keys.create'). Give the metric a name and a unit (like '1' for count). This creates a numeric metric that Cloud Monitoring can use.
Create a Cloud Monitoring Alert Policy
Go to Cloud Monitoring and select 'Alerting'. Click 'Create Policy'. Choose the log-based metric you just created as the condition. Set a threshold (e.g., 'metric value is above 10 for 1 minute'). Configure the notification channel (email, SMS, Slack webhook). The alert fires when the condition is met.
Query Logs with Logging Query Language
In Cloud Logging, use the query bar to search logs. For example, type 'resource.type=gce_instance AND protoPayload.methodName=compute.instances.stop' to find all shutdown events on Compute Engine virtual machines. Use the 'Run Query' button to see results. This is how you investigate incidents after an alert fires.
Test the Export Pipeline
After creating the log sink, perform a test action (like creating a test virtual machine). Check that the log entry appears in the destination — for example, look for a new file in the Cloud Storage bucket you specified. This step confirms the export is working before you rely on it for compliance or security monitoring.
An IT security professional at a mid-size retail company is responsible for making sure no one tampered with the company's e-commerce platform running on Google Cloud. This professional wants to know every time someone creates or deletes a Kubernetes pod, and also wants to detect brute-force attacks on the database.
Step one: they enable Admin Activity logs (already on by default) and then enable Data Access logs for the BigQuery dataset that stores customer orders. This means every SQL query that reads customer data will be recorded.
Step two: they create a log sink that exports Admin Activity logs to a Cloud Storage bucket. The bucket has a retention policy that keeps logs for three years to meet PCI-DSS compliance requirements. They also create a second log sink that exports Data Access logs to a Pub/Sub topic, which feeds directly into a Splunk SIEM running on a separate set of servers.
Step three: they create a custom metric in Cloud Monitoring that counts the number of times a specific API call — 'iam.serviceAccounts.keys.create' — is made in a single hour. They attach an alert policy to this metric that sends a notification to the company's security Slack channel if the count exceeds 10 per hour.
Step four: they build a dashboard in Cloud Monitoring that shows a real-time line chart of failed SSH login attempts across all virtual machines, alongside a bar chart of storage bucket deletion events. They share this dashboard with the rest of the security team.
Step five: when a suspicious event is detected by the SIEM — for example, multiple failed logins followed by a successful login from an unusual IP address — the security professional opens the Cloud Logging interface and uses the Logging Query Language to search for all log entries from that IP address over the past 24 hours. They find that the IP address issued a command to export a database to a different cloud provider. They immediately revoke the user's access and open an incident response case.
The PCSE exam tests Security Logging and Monitoring with Cloud Audit Logs and SIEM in several distinct ways. You must know the exact difference between Admin Activity logs and Data Access logs. A common question will describe a scenario — "a user modified a firewall rule, and you need to find the log" — and the correct answer is Admin Activity logs, not Data Access logs, because modifying a firewall rule is a configuration change, not a data access operation.
Another frequent question type asks about log sinks. The exam might ask: "You need to export logs for long-term archival at the lowest cost." The correct answer is Cloud Storage, not BigQuery. BigQuery is for analysis, not low-cost archival. Cloud Storage has lower storage costs for rarely accessed logs.
You also need to know the default retention period for Cloud Audit Logs. Admin Activity logs are retained for 400 days by default. Data Access logs are retained for 30 days by default. You can extend retention by exporting logs to Cloud Storage or BigQuery. This is a specific number the exam loves to test.
The exam also tests the concept of log exclusion filters. You can create filters that prevent certain log entries from being ingested at all. This saves cost. A question might say: "You want to ignore health check log entries from a load balancer." The answer is to create a log exclusion filter that matches the health check pattern.
The exam tests the difference between Cloud Logging and Cloud Monitoring. Logging is about storing and retrieving events. Monitoring is about setting thresholds and sending alerts. They are separate services but work together. A question might ask: "You need to send an email when a new VM is created." This requires both a log sink to route the event to Cloud Monitoring, and an alert policy in Cloud Monitoring. You cannot set an alert directly on a log entry in Cloud Logging.
Finally, the exam tests the concept of log-based metrics. A log-based metric is a custom metric you define based on the count of log entries matching a certain filter. This is distinct from agent-based metrics that come from the operating system. The exam expects you to know when to use a log-based metric versus an agent-based metric.
Traps to watch for:
The exam might say "All audit logs are enabled by default." This is false. Only Admin Activity and System Event logs are enabled by default. Data Access logs must be manually enabled.
The exam might offer BigQuery as the answer for "lowest cost long-term storage." This is false. Cloud Storage is lower cost for storage that is rarely queried.
The exam might suggest using Cloud Monitoring to set an alert directly on a log entry without a log-based metric. This is not how it works — you need to create a log-based metric first.
Admin Activity logs record configuration changes and are always enabled — you cannot disable them.
Data Access logs record reads and writes to data and must be manually enabled per resource.
Cloud Audit Logs are retained for a maximum of 400 days (Admin Activity) or 30 days (Data Access) unless you export them.
To export logs, you create a log sink that streams logs to Cloud Storage, BigQuery, or Pub/Sub.
A SIEM is a third-party tool — Google Cloud does not include one by default.
Log exclusion filters drop log entries before they are stored, saving money and reducing noise.
Log-based metrics let you count specific log entries and use those counts in Cloud Monitoring alert policies.
Cloud Monitoring alerts require a metric — you cannot trigger an alert directly from a log entry without first creating a log-based metric.
These come up on the exam all the time. Here's how to tell them apart.
Admin Activity Logs
Records configuration changes (create, modify, delete resources)
Always enabled by default in all projects
Free to ingest — no additional cost
Data Access Logs
Records data reads and writes (view, download, query data)
Must be manually enabled per resource type
You pay for ingestion per gigabyte
Cloud Logging
Stores and indexes logs for searching
Primary interface: Log Viewer with query language
Retains logs for fixed periods unless exported
Cloud Monitoring
Analyses metrics and triggers alerts
Primary interface: dashboards and alerting policies
Requires metrics (from logs or agents) to work
Log Sink
Copies selected logs to a destination
Does not delete the original log in Cloud Logging
Used for export to storage or SIEM
Log Exclusion Filter
Prevents logs from being ingested at all
Logs are permanently lost — not stored anywhere
Used to reduce volume and save cost
Cloud Storage Export
Cheapest long-term storage option for logs
Logs are stored as files (JSON or CSV)
Harder to query — you must download files first
BigQuery Export
More expensive per gigabyte stored
Logs are stored as a SQL queryable table
Easy to run complex analytical queries
Log-Based Metric
Derived from log entries
Free to create — pay only for log ingestion
Can capture any event that produces a log line
Agent-Based Metric
Derived from software agents on virtual machines
May require licensing for the agent software
Captures OS-level stats like CPU and memory
Mistake
All Cloud Audit Logs are enabled by default and you do not need to configure anything.
Correct
Only Admin Activity logs and System Event logs are enabled by default. Data Access logs must be turned on manually for each resource because they generate high volume and cost.
Beginners assume that 'audit logging' is a single all-or-nothing switch. The exam deliberately tests which category of logs is on by default.
Mistake
Cloud Logging and Cloud Monitoring are the same service and can be used interchangeably.
Correct
Cloud Logging stores and lets you search log entries. Cloud Monitoring sets thresholds, creates dashboards, and sends alerts. They integrate but are separate products with different pricing and APIs.
Google Cloud's naming is confusing — 'logging' and 'monitoring' sound like the same thing to a non-IT person. The exam uses this confusion to create tempting wrong answers.
Mistake
The best way to keep logs for compliance is to increase the default retention period in Cloud Logging.
Correct
Cloud Logging cannot keep logs longer than 400 days (for Admin Activity logs) or 30 days (for Data Access logs). You must export logs to Cloud Storage or BigQuery for longer retention.
Beginners expect a simple slider to extend retention. The exam tests that learners understand export is the only way to retain logs beyond the default limits.
Mistake
A SIEM is a feature built into Google Cloud that you can just enable with one click.
Correct
Google Cloud does not have a built-in SIEM. You must export logs to a third-party SIEM (like Splunk or Microsoft Sentinel) via a log sink and a Pub/Sub topic.
Many cloud providers bundle a SIEM, but Google Cloud does not. Beginners who have used AWS or Azure might incorrectly assume a Google Cloud native SIEM exists.
Mistake
Log exclusion filters prevent logs from being exported, but the logs are still stored in Cloud Logging.
Correct
A log exclusion filter prevents logs from being ingested into Cloud Logging at all. They are dropped entirely and never stored or exported.
The word 'exclusion' sounds like it just hides logs from search, like a filter in a spreadsheet. The exam tests that exclusion means permanent discard.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Yes and no. Admin Activity logs and System Event logs are enabled by default in every project. Data Access logs are not — you must enable them manually for each resource type.
You do not pay to ingest Admin Activity logs or System Event logs — they are free. You do pay for Data Access log ingestion and for storage if you keep logs beyond the default retention period or export them.
A log sink copies logs to a destination (like Cloud Storage) and does not delete the original. A log exclusion prevents logs from being stored in Cloud Logging at all.
Create a log sink with a Pub/Sub topic as the destination. Configure a Splunk add-on or a custom subscriber to pull messages from that Pub/Sub topic and forward them to Splunk.
Not directly. You must first create a log-based metric that counts the log message, then create a Cloud Monitoring alert policy that watches that metric.
Admin Activity logs are stored for 400 days. Data Access logs are stored for 30 days. System Event logs are stored for 400 days. After that, they are automatically deleted.
You've finished Security Logging and Monitoring with Cloud Audit Logs and SIEM. Continue through the PCSE study guide to build a complete picture of the exam.
Done with this chapter?