Share via


az network watcher flow-log

管理網路安全性群組流程記錄。

如需設定流程記錄的詳細資訊,請造訪 https://docs.microsoft.com/azure/network-watcher/network-watcher-nsg-flow-logging-cli

命令

名稱 Description 類型 狀態
az network watcher flow-log create

在網路安全性群組上建立流程記錄。

核心 GA
az network watcher flow-log delete

刪除指定的流量記錄資源。

核心 GA
az network watcher flow-log list

列出指定之網路監看員的所有流程記錄資源。

核心 GA
az network watcher flow-log show

取得網路安全性群組的流量記錄組態。

核心 GA
az network watcher flow-log update

更新網路安全性群組的流程記錄組態。

核心 GA
az network watcher flow-log wait

將 CLI 置於等候狀態,直到符合條件為止。

核心 GA

az network watcher flow-log create

在網路安全性群組上建立流程記錄。

az network watcher flow-log create --name
                                   [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--format {JSON}]
                                   [--interval]
                                   [--location]
                                   [--log-version]
                                   [--nic]
                                   [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--nsg]
                                   [--resource-group]
                                   [--retention]
                                   [--storage-account]
                                   [--subnet]
                                   [--tags]
                                   [--traffic-analytics {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--vnet]
                                   [--workspace]

範例

使用網路安全性群組名稱建立流程記錄

az network watcher flow-log create --location westus --resource-group MyResourceGroup --name MyFlowLog --nsg MyNetworkSecurityGroupName --storage-account account

使用 VNet 名稱建立流程記錄

az network watcher flow-log create --location westus --resource-group MyResourceGroup --name MyFlowLog --vnet MyVNetName --storage-account account

使用子網名稱建立流程記錄

az network watcher flow-log create --location westus --resource-group MyResourceGroup --name MyFlowLog --vnet MyVNetName --subnet MySubnetName --storage-account account

使用 NIC 名稱建立流程記錄

az network watcher flow-log create --location westus --resource-group MyResourceGroup --name MyFlowLog --nic MyNICName --storage-account account

使用網路安全性群組識別碼建立流程記錄檔(可能位於其他資源群組中)

az network watcher flow-log create --location westus --name MyFlowLog --nsg MyNetworkSecurityGroupID --storage-account account

建立具有虛擬網絡識別碼的流程記錄檔(可能位於其他資源群組中)

az network watcher flow-log create --location westus --name MyFlowLog --vnet MyVNetID --storage-account account

使用子網識別碼建立流程記錄檔(可能位於其他資源群組中)

az network watcher flow-log create --location westus --name MyFlowLog --subnet SubnetID --storage-account account

使用網路介面識別碼建立流程記錄檔(可能位於其他資源群組中)

az network watcher flow-log create --location westus --name MyFlowLog --nic MyNetworkInterfaceID --storage-account account

必要參數

--name -n

流量記錄器的名稱。

選擇性參數

--enabled

啟用記錄功能。 預設值:true。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--format

流量記錄檔的檔案類型。

接受的值: JSON
--interval

以分鐘為單位進行流程分析的間隔。 暫時允許的值為 10 和 60。

預設值: 60
--location -l

用來識別區域下獨佔網路監看員的位置。 每個訂用帳戶和區域只能有一個網路監看員。 未指定時,將會使用資源群組的位置。

--log-version

流程記錄的版本(修訂)。

預設值: 0
--nic

網路介面 (NIC) 資源的名稱或識別碼。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--nsg

網路安全性群組的名稱或識別碼。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--retention

保留記錄的天數。

--storage-account

用來儲存流量記錄的儲存體帳戶名稱或識別碼。 必須位於相同的流量記錄區域中。

--subnet

子網的名稱或識別碼。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「」 清除現有的標記。 支援速記語法、json-file 和 yaml-file。 請嘗試 「??」 以顯示更多。

--traffic-analytics

啟用流量分析。 如果 --workspace 提供 ,則預設為 true。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--vnet

虛擬網絡資源的名稱或識別碼。

--workspace

Log Analytics 工作區的名稱或識別碼。 必須位於相同的流量記錄區域中。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network watcher flow-log delete

刪除指定的流量記錄資源。

az network watcher flow-log delete --name
                                   [--location]
                                   [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]

範例

刪除指定的流量記錄資源。

az network watcher flow-log delete --location westus2 --name MyFlowLogger

必要參數

--name -n

流量記錄器的名稱。

選擇性參數

--location -l

用來識別區域下獨佔網路監看員的位置。 每個訂用帳戶和區域只能有一個網路監看員。 未指定時,將會使用資源群組的位置。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network watcher flow-log list

列出指定之網路監看員的所有流程記錄資源。

az network watcher flow-log list [--location]

範例

列出指定之網路監看員的所有流程記錄資源。

az network watcher flow-log list --location westus2

選擇性參數

--location -l

用來識別區域下獨佔網路監看員的位置。 每個訂用帳戶和區域只能有一個網路監看員。 未指定時,將會使用資源群組的位置。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network watcher flow-log show

取得網路安全性群組的流量記錄組態。

az network watcher flow-log show [--location]
                                 [--name]
                                 [--nsg]
                                 [--resource-group]

範例

顯示 NSG 流量記錄。 (已取代)

az network watcher flow-log show -g MyResourceGroup --nsg MyNsg

顯示已格式化 Azure 資源管理的 NSG 流量記錄。

az network watcher flow-log show --location MyNetworkWatcher --name MyFlowLog

選擇性參數

--location -l

用來識別區域下獨佔網路監看員的位置。 每個訂用帳戶和區域只能有一個網路監看員。

--name -n

流量記錄器的名稱。

--nsg
已被取代

引數 'nsg' 已被取代,未來版本將會移除。 請改用 '--location 和 --name 組合'。

網路安全性群組的名稱或識別碼。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network watcher flow-log update

更新網路安全性群組的流程記錄組態。

az network watcher flow-log update --name
                                   [--add]
                                   [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--format {JSON}]
                                   [--interval]
                                   [--location]
                                   [--log-version]
                                   [--nic]
                                   [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--nsg]
                                   [--remove]
                                   [--resource-group]
                                   [--retention]
                                   [--set]
                                   [--storage-account]
                                   [--subnet]
                                   [--tags]
                                   [--traffic-analytics {0, 1, f, false, n, no, t, true, y, yes}]
                                   [--vnet]
                                   [--workspace]

範例

以名稱更新儲存體帳戶,讓資源群組識別儲存體帳戶和網路監看員

az network watcher flow-log update --location westus --resource-group MyResourceGroup --name MyFlowLog --storage-account accountname

使用識別碼更新儲存體帳戶,讓位置識別網路監看員

az network watcher flow-log update --location westus --resource-group MyResourceGroup --name MyFlowLog --storage-account accountid

更新另一個資源群組上的網路安全性群組

az network watcher flow-log update --location westus --resource-group MyAnotherResourceGroup --name MyFlowLog --nsg MyNSG

更新另一個資源群組上的虛擬網絡

az network watcher flow-log update --location westus --resource-group MyAnotherResourceGroup --name MyFlowLog --vnet MyVNet

更新另一個資源群組上的子網

az network watcher flow-log update --location westus --resource-group MyAnotherResourceGroup --name MyFlowLog --vnet MyVNet --subnet MySubnet

更新另一個資源群組上的網路介面

az network watcher flow-log update --location westus --resource-group MyAnotherResourceGroup --name MyFlowLog --nic MyNIC

更新另一個資源群組上的工作區

az network watcher flow-log update --location westus --resource-group MyAnotherResourceGroup --name MyFlowLog --workspace MyAnotherLogAnalyticWorkspace

必要參數

--name -n

流量記錄器的名稱。

選擇性參數

--add

藉由指定路徑和索引鍵值組,將 物件加入物件清單。 範例:--add property.listProperty < key=value、string 或 JSON 字串 > 。

--enabled

啟用記錄功能。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--force-string

使用 'set' 或 'add' 時,請保留字元串常值,而不是嘗試轉換成 JSON。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--format

流量記錄檔的檔案類型。

接受的值: JSON
--interval

以分鐘為單位進行流程分析的間隔。 暫時允許的值為 10 和 60。

--location -l

用來識別區域下獨佔網路監看員的位置。 每個訂用帳戶和區域只能有一個網路監看員。 未指定時,將會使用資源群組的位置。

--log-version

流程記錄的版本(修訂)。

--nic

網路介面 (NIC) 資源的名稱或識別碼。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--nsg

網路安全性群組的名稱或識別碼。

--remove

從清單中移除屬性或專案。 範例:--remove property.list OR --remove 屬性ToRemove。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--retention

保留記錄的天數。

--set

指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=。

--storage-account

用來儲存流量記錄的儲存體帳戶名稱或識別碼。 必須位於相同的流量記錄區域中。

--subnet

子網的名稱或識別碼。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「」 清除現有的標記。 支援速記語法、json-file 和 yaml-file。 請嘗試 「??」 以顯示更多。

--traffic-analytics

啟用流量分析。 如果 --workspace 提供 ,則預設為 true。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--vnet

虛擬網絡資源的名稱或識別碼。

--workspace

Log Analytics 工作區的名稱或識別碼。 必須位於相同的流量記錄區域中。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network watcher flow-log wait

將 CLI 置於等候狀態,直到符合條件為止。

az network watcher flow-log wait [--created]
                                 [--custom]
                                 [--deleted]
                                 [--exists]
                                 [--ids]
                                 [--interval]
                                 [--name]
                                 [--network-watcher-name]
                                 [--resource-group]
                                 [--subscription]
                                 [--timeout]
                                 [--updated]

選擇性參數

--created

請等候在 'Succeeded' 使用 'provisioningState' 建立。

預設值: False
--custom

等到條件符合自訂 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到刪除為止。

預設值: False
--exists

等候資源存在。

預設值: False
--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--interval

輪詢間隔以秒為單位。

預設值: 30
--name -n

流量記錄器的名稱。

--network-watcher-name

網路監看員的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--timeout

以秒為單位的等候上限。

預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

預設值: False
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。