0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure Firewall の構造化診断ログを有効化するために注意する箇所

Last updated at Posted at 2025-08-16

背景

Azure Firewall の診断ログは二つのタイプがあります。
従来の[AzureDiagnostics]と最新の[Resource specific]形式です。
構造化診断ログは[Resource specific]を指すものです。

image.png

説明

従来の[AzureDiagnostics]には、Applicationrule,Networkrule,DNSproxyの記録があり、そして大事な情報は全部msg_sの中にあります。
image.png

このmsg_sからさらに別列で絞り出すために、data parseをする必要があります。とても使いづらいです。
When querying the AzureDiagnostic you need to specify what category you want to look for, as ‘AzureFirewallNetworkRuleLog’. Then all the important information as source/destination IPs and ports, protocol, rule name and action are located at the column ‘msg_s’.
So, if you want to split the data in different columns, you will have to parse it by using a more complex KQL query as below
image.png

この辛さを解決できたのは今の[Resource specific]形式のログです。

この構造化診断ログを有効化するために、まず以下のコマンドでAFWEnableStructuredLogsが登録になっているか確認する必要があります。

Get-AzProviderFeature -FeatureName "AFWEnableStructuredLogs" -ProviderNamespace "Microsoft.Network"

FeatureName             ProviderName      RegistrationState
-----------             ------------      -----------------
AFWEnableStructuredLogs Microsoft.Network NotRegistered

NotRegisteredなので、register作業をやります。

Register-AzProviderFeature -FeatureName "AFWEnableStructuredLogs" -ProviderNamespace "Microsoft.Network"

FeatureName             ProviderName      RegistrationState
-----------             ------------      -----------------
AFWEnableStructuredLogs Microsoft.Network Registered

Registerした後に診断設定のところで[Resource specific]に変更します
image.png

変更したら、AzFWを再起動するか、何かAzFW policyのルール設定を変更したりして、AzFWに設定を反映させる必要もあります。これが実施した後、構造化診断ログがつかえるようになります。

これでKQLのtableはAzureDiagnosticsではなく、それぞれリソース固有のtableになります。
以下のとおり、大事な情報はそれぞれ適切な列に整理されていますので、とても使いやすいです。

image.png

最後

設定した後に、AzFWになんかput作業が必要であることは忘れないでね。この部分は公開文章に書いていないですので、「設定したのに、なぜ構造化ログが出てこないの」と結構迷います。

後、構造化診断ログが設定成功したら、設定前のログは依然AzureDiagnosticsでみます。リソース固有のtableでみれません。設定成功後のログはリソース固有のtableでみれるようになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?