簡體   English   中英

如何編寫使用正則表達式過濾 where 子句的 Kusto 查詢

[英]How do I write a Kusto query that uses a regex to filter on a where clause

在 Azure Log Analytics 中,我嘗試使用 Kusto 來查詢具有使用正則表達式的 where 條件的請求。 我正在嘗試的查詢是

requests
| where customDimensions.["API Name"] matches regex "\w*-v\d*"

但這會返回語法錯誤。 此處文檔中給出的示例是有限的,但暗示此語法應該有效。 上面的一個更簡單的版本確實有效

requests
| where customDimensions.["API Name"] matches regex ".*-v.*"

where <predicate> matches regex的正確語法是什么?

如果正則表達式包含反斜杠,那么它必須作為逐字字符串傳遞,如此所述。 以下語法有效

requests
| where customDimensions.["API Name"] matches regex @'\w*-v\d*'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM