Skip to content
Visual explainer 3h to learn 5 steps

Audit Logs, Security Command Center and VPC Service Controls

Read audit logs, triage a Security Command Center finding and diagnose a synthetic request blocked by VPC Service Controls.

By Invicly Tech, , in Google Cloud Engineering and Services. About 10 minutes to read.

Topic 26 of 32

In short

Cloud Audit Logs record who did what in your projects. Security Command Center gathers findings about risky settings and threats. VPC Service Controls draws a perimeter around Google Cloud services so data cannot be copied out, even by someone who has the right IAM role.

Think of it like this: IAM is the key to a room. A service perimeter is the fence around the whole building, so a key holder still cannot carry things out the gate.

Explained simply

Security work in the cloud starts with a simple question: who did what, and when? Cloud Audit Logs answer it. Every time someone creates a VM, changes a permission or reads sensitive data, Google Cloud can write an audit entry with the caller, the action and the resource.

There are two kinds you will meet first. Admin Activity logs record changes to configuration, and they are always on. Data Access logs record reads and writes of user data. Most of those are off by default because they can be large, so you turn them on for the services that hold important data.

Security Command Center, often called SCC, is a dashboard of findings. A finding says something like a bucket is public or a firewall rule opens SSH to the world. Each has a severity and a resource. Your job is to triage it: fix it, accept the risk with a reason, or mute it.

IAM decides who may call an API. VPC Service Controls adds a boundary around projects and services, so data cannot leave even if someone has permission. Think of IAM as the key and the perimeter as the fence around the building.

Press Play on a diagram to walk through it one step at a time.

LayersLayers of control around your data
  1. 1
    Service perimeter

    VPC Service Controls: which projects and services may talk to which.

  2. 2
    IAM

    Which identity may call which API on which resource.

  3. 3
    Organization policy

    Rules such as no external IP addresses.

  4. 4
    Audit logs

    A record of the admin and data calls that were made.

  5. 5
    Security Command Center

    Findings that point at risky settings.

SequenceA request blocked by a perimeter
Analyst laptop
Google API
VPC Service Controls
Audit log
  1. 1bigquery query on a protected project
    Analyst laptop to Google API: bigquery query on a protected project
  2. 2Check perimeter, access level and rules
    Google API to VPC Service Controls: Check perimeter, access level and rules
  3. 3Deny: caller is outside the perimeter
    VPC Service Controls to Google API: Deny: caller is outside the perimeter
  4. 4Error: request is prohibited by organization's policy
    Google API to Analyst laptop: Error: request is prohibited by organization's policy
  5. 5Write violation entry with a unique ID
    VPC Service Controls to Audit log: Write violation entry with a unique ID
FlowTriage routine for one finding
  1. 1
    Read

    Category, severity, resource.

  2. 2
    Confirm

    Is it real and who owns it?

  3. 3
    Decide

    Fix, accept or mute.

  4. 4
    Fix

    Change the setting or the code.

  5. 5
    Verify

    The finding turns inactive.

In depth

Reading audit logs

Audit entries live in Cloud Logging. Admin Activity and System Event entries go to the _Required bucket, which is kept for 400 days and cannot be turned off. Data Access entries go to the _Default bucket unless you route them elsewhere.

A useful entry has protoPayload.authenticationInfo.principalEmail (who), protoPayload.methodName (what) and protoPayload.resourceName (which resource). To answer who deleted a bucket, filter on the log name for activity and the method storage.buckets.delete. To answer who read a file, Data Access logs for Cloud Storage must have been enabled before it happened.

  • Admin Activity: always on, no charge
  • Data Access: enable per service, can be large
  • Who is principalEmail, what is methodName
  • Route audit logs to a separate project for safekeeping

Triaging a Security Command Center finding

A finding has a category (such as public bucket), a severity, the affected resource, and a state of active or inactive. Which SCC features you see depends on the tier your organisation bought, so check the current overview page.

A simple triage routine works well. Read the resource and confirm it is real. Decide if it is expected: a public website bucket may be fine. If it is a mistake, fix the cause, then wait for the finding to turn inactive. If it is accepted, mute it with a note saying why. Never mute only because the list looks long.

  • Confirm the resource and the owner
  • Fix the cause, not only the symptom
  • Mute only with a written reason
  • Review mute rules every quarter

Service perimeters and where IAM ends

A VPC Service Controls perimeter lists projects and the services it protects, such as BigQuery and Cloud Storage. Calls between resources inside the perimeter work. Calls from outside, or copies to projects outside, are blocked unless an access level or an ingress or egress rule allows them.

IAM cannot stop a user with a valid role from copying a dataset to a personal project. A perimeter can, because it checks the project boundary. Use both. IAM limits who. The perimeter limits where data may move. Start in dry-run mode, read the violations, adjust rules, then enforce.

LayersWhat each control answers
  1. 1
    Perimeter

    Is the caller or the target inside the allowed boundary?

  2. 2
    IAM

    Is this identity allowed to do this action?

  3. 3
    Resource settings

    Is the bucket or table configured safely?

Diagnosing a perimeter denial

A blocked request returns an error saying the request is prohibited by the organization's policy, and the log entry names VPC Service Controls as the reason. The entry includes a unique ID, the caller, the service and the project. Search the logs for that ID.

Then ask three things. Is the caller meant to be outside? If so, add an access level or an ingress rule. Is the target project missing from the perimeter? If so, add it. Is it a real attempt to move data out? If so, leave it blocked and tell the owner. Fix one thing at a time and test again.

  • Find the violation entry by its unique ID
  • Check caller, service and project
  • Change the smallest rule that fixes it
  • Never widen a perimeter just to silence an error

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Read Admin Activity and Data Access logs~35m
  2. 2
    Triage a Security Command Center finding~35m
  3. 3
    Explain service perimeters~35m
  4. 4
    Diagnose a perimeter denial~35m
  5. 5
    Know where IAM ends and perimeters begin~35m

Key points

  • Admin Activity audit logs are always on. Data Access logs are mostly off by default and you turn them on for the services that matter.
  • A Security Command Center finding has a category, a severity, an affected resource and a state. Triage means decide, fix or mute with a reason.
  • VPC Service Controls checks where a request comes from, not only who sends it. IAM checks who.
  • You can run a perimeter in dry-run mode first. Violations are logged but not blocked.
  • A denial log entry carries a unique ID that helps you find the matching rule to change.

Key terms

Tap a card to flip it. 0/6 known

Examples

Who deleted the bucket?

A bucket named contoso-orders-archive is gone. Admin Activity logs are always on, so the answer is there. Filter on the delete method and read the caller's email. Expect one entry with a timestamp and a principalEmail. If there is none, check the project ID and the time range.

bash
gcloud logging read \
  'protoPayload.methodName="storage.buckets.delete" AND protoPayload.resourceName:"contoso-orders-archive"' \
  --project=<project-id> --limit=3 \
  --format='value(timestamp,protoPayload.authenticationInfo.principalEmail)'

A synthetic perimeter denial

An analyst at fabrikam runs a BigQuery query from a laptop and sees a policy error. You search the logs for the violation ID in the message. The entry shows the caller is outside the perimeter and no access level matches. The fix is an access level for the corporate IP range, tested in dry-run mode first, not removing the project from the perimeter.

text
error:    Request is prohibited by organization's policy
          vpcServiceControlsUniqueIdentifier: <unique-id>
caller:   analyst@fabrikam.example.com from 203.0.113.9
service:  bigquery.googleapis.com
result:   no ingress rule or access level matches
fix:      add access level for the approved range, dry run first

Quick reference

  • Admin Activity audit logs: always on; Data Access logs: mostly off until you enable them
  • Who: principalEmail. What: methodName. Which: resourceName
  • Audit logs for admin changes stay 400 days in _Required
  • SCC finding: category, severity, resource, state
  • Mute a finding only with a written reason
  • IAM = who may act; perimeter = where data may go
  • Use perimeter dry-run mode before enforcing

Common mistakes

  • Assuming Data Access logs are on. If nobody enabled them, you cannot answer who read a bucket.
  • Turning a perimeter on in enforced mode without a dry run. Build pipelines and partners can break at once.
  • Treating IAM as enough. A stolen credential with the right role can still copy data out if no perimeter exists.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which audit logs can you not turn off?

Question 2

2A user has the right IAM role but cannot copy data to an outside project. Likely cause?

Question 3

3What should you do first before enforcing a new perimeter?

Question 4

4Which field names the person who made a call in an audit log?

Question 5

5When is it fine to mute an SCC finding?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Write a Logs Explorer filter to find who created Compute Engine instances in a project.

  2. Exercise 2medium

    A Data Access log for Cloud Storage is empty although a file was read yesterday. Give two possible reasons and what you would change.

  3. Exercise 3hard

    Plan a rollout of a VPC Service Controls perimeter around a project with BigQuery and Cloud Storage. List the steps and the evidence for each.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Are audit logs free?
Admin Activity logs are free. Data Access logs can add cost because of their volume, so enable them where they matter.
Does VPC Service Controls replace IAM?
No. IAM decides who may do an action. A perimeter adds a boundary on where data may move. You need both.
What does Security Command Center find?
Risky settings and threats such as public buckets or open firewall rules. What you see depends on your tier.

Go deeper

ShareXLinkedInWhatsApp