Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Commit 8f1e46e

Browse files
author
Mathieu Benoit
committed
Cloud Armor logging
1 parent f38f031 commit 8f1e46e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "Monitor WAF rules"
3+
weight: 6
4+
description: "Duration: 5 min | Persona: Platform Admin"
5+
tags: ["monitoring", "platform-admin", "security-tips"]
6+
---
7+
![Platform Admin](/images/platform-admin.png)
8+
_{{< param description >}}_
9+
10+
In this section, you will [monitor Cloud Armor security policies logs](https://cloud.google.com/armor/docs/request-logging) (WAF rules).
11+
12+
Initialize variables:
13+
```Bash
14+
WORK_DIR=~/
15+
source ${WORK_DIR}acm-workshop-variables.sh
16+
```
17+
18+
Using logging, you can view every request evaluated by a Google Cloud Armor security policy and the outcome or action taken.
19+
20+
In the Google Cloud console, navigate to _Network Security > Cloud Armor_ service. Click on the link displayed by the command below:
21+
```Bash
22+
echo -e "https://pantheon.corp.google.com/net-security/securitypolicies/details/${SECURITY_POLICY_NAME}?project=${TENANT_PROJECT_ID}"
23+
```
24+
25+
Select the **Logs** tab and click on **View policy logs**. From here, change _Last 1 hour_ by **Last 7 days** (top left) and enable the **Show query** toggle (top right):
26+
27+
![Cloud Armor logging](/images/cloud-armor-logging.png)
28+
29+
In the **Query** field you could add a new ligne with `jsonPayload.enforcedSecurityPolicy.outcome="DENY"` for example in order to see all the requests denied by the WAF rules you set up earlier in this workshop.
30+
31+
You could also leverage the `gcloud` command below to get such insights.
32+
33+
Run this command in Cloud Shell:
34+
```Bash
35+
filter="resource.type=\"http_load_balancer\" "\
36+
"jsonPayload.enforcedSecurityPolicy.name=\"${SECURITY_POLICY_NAME}\" "\
37+
"jsonPayload.enforcedSecurityPolicy.outcome=\"DENY\""
38+
39+
gcloud logging read --project $TENANT_PROJECT_ID "$filter"
40+
```
335 KB
Loading

0 commit comments

Comments
 (0)