-- Exact instance-name label unavailable; using global keyword search.
(resource.type="gce_instance") AND
(SEARCH("web-prod-2")) AND
(severity>=WARNING)
03
壓力題
未知欄位的安全退化
測試問題
請產生 Google Cloud Logging LQL,從 Cloud Run 紀錄找出自訂欄位 fraudDecision 等於 BLOCK 的事件。你沒有該應用的 payload schema。只輸出查詢;若必須退化查詢,可使用合法 LQL 註解說明。
-- 未知 payload schema;退化為跨欄位文字搜尋,可能包含誤判
resource.type = "cloud_run_revision"
AND "fraudDecision"
AND "BLOCK"
已載入 Skill +860 tokens · 34734 ms
-- 未知 payload schema,退化為全域關鍵字搜尋;兩個詞可能出現在不同欄位,無法保證為欄位等值比較。
(resource.type=("cloud_run_revision" OR "cloud_run_job")) AND
(log_id("run.googleapis.com/stdout") OR log_id("run.googleapis.com/stderr")) AND
(SEARCH("fraudDecision BLOCK"))
```
-- Cloud Run(服務 + Job)紀錄
resource.type=("cloud_run_revision" OR "cloud_run_job")
-- 退化查詢說明:無此應用的 payload schema,無法確定 fraudDecision 的實際欄位路徑,
-- 因此列舉常見位置 + 全文比對兜底。確認 schema 後請刪掉不適用的分支以降低誤判。
(
jsonPayload.fraudDecision="BLOCK"
OR jsonPayload.decision.fraudDecision="BLOCK"
OR jsonPayload.message.fraudDecision="BLOCK"
OR labels.fraudDecision="BLOCK"
OR protoPayload.metadata.fraudDecision="BLOCK"
-- 兜底:涵蓋 textPayload 與未知嵌套層級;可能因 "BLOCK" 出現在其他欄位而誤判
OR SEARCH("fraudDecision BLOCK")
)
```
已載入 Skill +912 tokens · 14370 ms
```
-- Degraded query: "fraudDecision" is a custom field not present in the Cloud Run
-- log schema references, so its exact path (jsonPayload.* vs. nested object) is unknown.
-- This uses global keyword SEARCH scoped to Cloud Run logs instead of an exact field match.
-- Caveat: SEARCH is case-insensitive and token-based, so this can match entries where
-- "fraudDecision" and "BLOCK" appear in unrelated fields of the same entry.
-- Once the payload path is confirmed, replace the SEARCH terms with an exact match,
-- for example: jsonPayload.fraudDecision="BLOCK"
resource.type="cloud_run_revision"
AND (log_id("run.googleapis.com/stdout") OR log_id("run.googleapis.com/stderr") OR log_id("run.googleapis.com/requests"))
AND SEARCH("fraudDecision")
AND SEARCH("BLOCK")
```