瞭解及查看記錄

本頁面將概略說明 Secure Web Proxy 記錄、可用的記錄類型,以及如何存取這些記錄。

總覽

Secure Web Proxy 記錄功能可讓您在下列重要領域擷取資訊並執行重要工作:

  • 監控和法規遵循

    • 強制遵守法規、提升網路安全性,並提供對網際網路目的地流量的可視性。
    • 取得有價值的層級控管功能,並掌握工作負載流量。
    • 取得關鍵洞察資料,有效監控資安營運中心 (SOC)。
    • 使用記錄偵測及追蹤安全性事件,以便主動回應威脅。
  • 部署和設定

    • 追蹤初始基礎架構設定、使用者帳戶建立作業和設定變更。
    • 監控潛在錯誤,確保順利安全地完成部署作業。
    • 瞭解政策調整的影響,並改善保護措施。

可用的記錄檔

Secure Web Proxy 提供下列記錄類型:

  • Cloud 稽核記錄
  • Proxy 交易記錄

Cloud 稽核記錄

Cloud 稽核記錄提供下列詳細資料:

  • 與基礎架構和 Proxy 設定、政策建立和修改,以及監控檢查相關的 API 呼叫資訊。為了擷取互動情形,Cloud 稽核記錄會使用 Google Cloud CLI 指令和 Secure Web Proxy API。
  • 與建立及刪除 Secure Web Proxy 執行個體、修改設定和套用更新相關的資訊。 Google Cloud 控制台記錄會記錄與 Secure Web Proxy 設定相關的控制台活動。
  • 深入瞭解 Secure Web Proxy 基礎架構的變更。
  • 調整 Secure Web Proxy 設定、規則和參數,以便調整 Secure Web Proxy 的行為。
  • 修改 Secure Web Proxy 中的使用者權限和存取權控管機制。
  • 實作政策修改內容,擷取編輯前和編輯後的詳細資料。

Secure Web Proxy 稽核記錄會遵循標準稽核記錄結構。如要瞭解標準稽核記錄格式,請參閱 AuditLog

Proxy 交易記錄

Proxy 交易記錄會擷取 Secure Web Proxy 處理的個別要求詳細資料。記錄檔會詳細記錄使用者與網際網路之間的每筆交易,這些交易都是由 Secure Web Proxy 進行調解。

代理程式交易記錄項目可分為下列類型:

HttpRequest

HttpRequest 記錄項目包含下列資訊:

名稱 類型 說明
requestMethod 字串 要求方法。例如:GETHEADPUTPOST
requestUrl 字串 要求的網址中,架構 (http、https)、主機名稱、路徑和查詢部分。例如:「http://example.com/some/info?color=red」。
requestSize

字串 (int64 格式)

HTTP 要求訊息的大小 (以位元組為單位),包括要求標頭和要求主體。

狀態 整數 表示回應的 HTTP 或 HTTPS 狀態碼。例如:200404
responseSize 字串 (int64 格式) 傳回給用戶端的 HTTP 回應訊息大小 (以位元組為單位),包括回應標頭和回應主體。
userAgent 字串 用戶端傳送的使用者代理程式。例如:「Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)」。
remoteIp 字串 發出 HTTP 要求的用戶端 IP 位址 (IPv4 或 IPv6)。這個欄位可包含連接埠資訊。例如:192.168.1.110.0.0.1:80FE80::0202:B3FF:FE1E:8329
serverIp 字串 要求傳送至的來源伺服器 IP 位址 (IPv4 或 IPv6)。這個欄位可包含連接埠資訊。例如:192.168.1.110.0.0.1:80FE80::0202:B3FF:FE1E:8329
referrer 字串

請求的參照網址,如 HTTP/1.1 標頭欄位定義所定義。

延遲 字串 (Duration 格式) 伺服器上的要求處理延遲時間,從收到要求到傳送回應的時間。

以秒為單位的時間長度,最多九個小數位數,結尾為 s。範例:3.5s

cacheLookup 布林值 是否嘗試快取查詢。
cacheHit 布林值 實體是否由快取提供 (是否經過驗證)。
cacheValidatedWithOriginServer 布林值 在從快取提供回應之前,是否已向原始伺服器驗證回應。只有在 cacheHit 為 True 時,這個欄位才有意義。
cacheFillBytes 字串 (int64 格式) 插入快取的 HTTP 回應位元組數。只有在嘗試填入快取時才會設定。
protocol 字串 用於要求的通訊協定。例如:「HTTP/1.1」、「HTTP/2」、「websocket」

LoadBalancerLogEntry

LoadBalancerLogEntry 記錄項目包含下列資訊:

名稱 類型 說明
insertId 字串 不重複的記錄 ID。
jsonPayload.@type 字串 記錄類型。

記錄類型值一律為
type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry

jsonPayload.enforcedGatewaySecurityPolicy.hostname 字串 與要求相關聯的主機名稱。
jsonPayload.enforcedGatewaySecurityPolicy.matchedRules.action 字串 針對要求採取的動作。
jsonPayload.enforcedGatewaySecurityPolicy.matchedRules.rule 字串 套用至要求的規則名稱。
jsonPayload.enforcedGatewaySecurityPolicy.clientServiceAccount 字串 與要求相關聯的服務帳戶。
jsonPayload.enforcedGatewaySecurityPolicy.clientSecureTags 字串 與要求相關聯的安全標記。

閘道監控資源

Gateway 監控資源記錄項目包含下列資訊:

名稱 類型 說明
resource_container 字串 與閘道相關聯的容器。
location 字串 定義閘道的區域名稱。
network_name 字串 建立閘道時所用的虛擬私有雲 (VPC) 網路名稱。
gateway_type 字串 閘道類型列舉。
gateway_name 字串 閘道資源的名稱。

記錄範例

Secure Web Proxy 在處理要求時會產生詳細的記錄項目,追蹤其動作和套用的政策。以下範例說明 Secure Web Proxy 記錄檔的運作方式。

允許項目範例

下列記錄項目顯示,Secure Web Proxy 攔截並檢查 [www.example.com](https://www.example.com/) 的 HTTPS 流量,並允許流量繼續傳送至目的地網站。政策和規則名稱分別為 swp-policyallow-port-443

欄位
enforcedGatewaySecurityPolicy "requestWasTlsIntercepted": true,
"hostname": "www.example.com",
"matchedRules": [
{
"action": "ALLOWED",
"name": "projects/76537/locations/us-central1/gatewaySecurityPolicies/swp-policy/rules/allow-port-443"
}
]
httpRequest "requestMethod": "GET",
"requestUrl": "https://www.example.com/",
"requestSize": "41",
"status": 200,
"responseSize": "1446",
"userAgent": "curl/7.74.0",
"remoteIp": "10.128.0.12:35418",
"serverIp": "93.184.216.34:443",
"latency": "0.051800s",
"protocol": "HTTP/2"
資源 "type": "networkservices.googleapis.com/Gateway",
"labels": {
"gateway_name": "multi-level-tlds",
"network_name": "projects/76537/global/networks/default",
"location": "us-central1",
"resource_container": "",
"gateway_type": "SECURE_WEB_GATEWAY"
}
時間戳記 "2024-02-15T16:56:19.570534Z"
嚴重性 「INFO」
logName 「projects/76537/logs/networkservices.googleapis.com%2Fgateway_requests」
receiveTimestamp "2024-02-15T16:56:20.714988329Z"

拒絕加入項目範例

這項記錄項目顯示 Secure Web Proxy 檢查了 www.example.com:443 的流量,並因 Secure Web Proxy 政策中的 default_denied 規則而拒絕 HTTPS 要求。

欄位
enforcedGatewaySecurityPolicy "hostname": "www.example.com:443",
"matchedRules": [
{
"name": "default_denied",
"action": "DENIED"
}
]
httpRequest
"requestMethod": "CONNECT",
"requestSize": "122",
"status": 403,
"responseSize": "141",
"userAgent": "curl/7.74.0",
"remoteIp": "10.128.0.12:36338",
"latency": "0.000133s",
"protocol": "HTTP/1.1"
資源 "type": "networkservices.googleapis.com/Gateway",
"labels": {
"gateway_type": "SECURE_WEB_GATEWAY",
"resource_container": "",
"location": "us-central1",
"network_name": "projects/gcp-1768/global/networks/default",
"gateway_name": "high-latency-repro"
}
時間戳記 "2024-02-15T16:55:00.089727Z"
嚴重性 「WARNING」
logName 「projects/gcp-1768/logs/networkservices.googleapis.com%2Fgateway_requests」
receiveTimestamp "2024-02-15T16:55:04.456901833Z"

在 Cloud Logging 中查看記錄

如要在 Logs Explorer 中查看 Secure Web Proxy 記錄,請執行下列步驟:

  1. 前往 Google Cloud 控制台的「Logs Explorer」頁面。

    前往「Logs Explorer」

  2. 在頁面頂端選取現有 Google Cloud 專案,或建立新專案。

  3. 使用下拉式選單,選取資源 networkservices.googleapis.com/Gateway 或 Secure Web Proxy 執行個體名稱。

詳情請參閱「使用記錄檔探索工具」。