次の方法で共有


サンプル クエリを使用してトラフィック分析スキーマの非推奨のフィールドを置き換える (2020 年 3 月のスキーマ更新)

トラフィック分析ログ スキーマには、次の新しいフィールドが含まれています。

  • SrcPublicIPs_s
  • DestPublicIPs_s
  • NSGRule_s

新しいフィールドは、送信元と宛先の IP アドレスに関する情報を提供し、クエリを簡素化します。

次の古いフィールドは、今後廃止される予定です。

  • VMIP_s
  • Subscription_g
  • Region_s
  • NSGRules_s
  • Subnet_s
  • VM_s
  • NIC_s
  • PublicIPs_s
  • FlowCount_d

次の 3 つの例は、古いフィールドを新しいフィールドに置き換える方法を示しています。

例 1: VMIP_sSubscription_gRegion_sSubnet_sVM_sNIC_sPublicIPs_s フィールド

スキーマでは、AzurePublic フローと ExternalPublic フローの FlowDirection_s フィールドからソースと宛先のケースを推論する必要はありません。 また、ネットワーク仮想アプライアンスに FlowDirection_s フィールドを使用することも不適切である場合があります。

前の Kusto クエリ:

AzureNetworkAnalytics_CL
| where SubType_s == "FlowLog" and FASchemaVersion_s == "1"
| extend isAzureOrExternalPublicFlows = FlowType_s in ("AzurePublic", "ExternalPublic")
| extend SourceAzureVM = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', VM_s, "N/A"), VM1_s),
SourceAzureVMIP = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', VM_s, "N/A"), SrcIP_s),
SourceAzureVMSubscription = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', Subscription_g, "N/A"), Subscription1_g),
SourceAzureRegion = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', Region_s, "N/A"), Region1_s),
SourceAzureSubnet = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', Subnet_s, "N/A"), Subnet1_s),
SourceAzureNIC = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'O', NIC_s, "N/A"), NIC1_s),
DestAzureVM = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', VM_s, "N/A"), VM2_s),
DestAzureVMIP = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', VM_s, "N/A"), DestIP_s),
DestAzureVMSubscription = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', Subscription_g, "N/A"), Subscription2_g),
DestAzureRegion = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', Region_s, "N/A"), Region2_s),
DestAzureSubnet = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', Subnet_s, "N/A"), Subnet2_s),
DestAzureNIC = iif(isAzureOrExternalPublicFlows, iif(FlowDirection_s == 'I', NIC_s, "N/A"), NIC2_s),
SourcePublicIPsAggregated = iif(isAzureOrExternalPublicFlows and FlowDirection_s == 'I', PublicIPs_s, "N/A"),
DestPublicIPsAggregated = iif(isAzureOrExternalPublicFlows and FlowDirection_s == 'O', PublicIPs_s, "N/A")

新しい Kusto クエリ:

AzureNetworkAnalytics_CL
| where SubType_s == "FlowLog" and FASchemaVersion_s == "2"
| extend SourceAzureVM = iif(isnotempty(VM1_s), VM1_s, "N/A"),
SourceAzureVMIP = iif(isnotempty(SrcIP_s), SrcIP_s, "N/A"),
SourceAzureVMSubscription = iif(isnotempty(Subscription1_g), Subscription1_g, "N/A"),
SourceAzureRegion = iif(isnotempty(Region1_s), Region1_s, "N/A"),
SourceAzureSubnet = iif(isnotempty(Subnet1_s), Subnet1_s, "N/A"),
SourceAzureNIC = iif(isnotempty(NIC1_s), NIC1_s, "N/A"),
DestAzureVM = iif(isnotempty(VM2_s), VM2_s, "N/A"),
DestAzureVMIP = iif(isnotempty(DestIP_s), DestIP_s, "N/A"),
DestAzureVMSubscription = iif(isnotempty(Subscription2_g), Subscription2_g, "N/A"),
DestAzureRegion = iif(isnotempty(Region2_s), Region2_s, "N/A"),
DestAzureSubnet = iif(isnotempty(Subnet2_s), Subnet2_s, "N/A"),
DestAzureNIC = iif(isnotempty(NIC2_s), NIC2_s, "N/A"),
SourcePublicIPsAggregated = iif(isnotempty(SrcPublicIPs_s), SrcPublicIPs_s, "N/A"),
DestPublicIPsAggregated = iif(isnotempty(DestPublicIPs_s), DestPublicIPs_s, "N/A")

例 2: NSGRules_s フィールド

古いフィールドでは、次の形式が使用されていました。

<Index value 0)>|<NSG_ RuleName>|<Flow Direction>|<Flow Status>|<FlowCount ProcessedByRule>

スキーマは、ネットワーク セキュリティ グループ (NSG) 全体でデータを集計しなくなりました。 更新されたスキーマでは、 NSGList_s にはネットワーク セキュリティ グループが 1 つだけ含まれています。 また、 NSGRules にはルールが 1 つだけ含まれています。 複雑な書式設定は、次の例に示すように、ここと他のフィールドでは削除されています。

前の Kusto クエリ:

AzureNetworkAnalytics_CL
| where SubType_s == "FlowLog" and FASchemaVersion_s == "1"
| extend NSGRuleComponents = split(NSGRules_s, "|")
| extend NSGName = NSGList_s // remains same
| extend NSGRuleName = NSGRuleComponents[1],
         FlowDirection = NSGRuleComponents[2],
         FlowStatus = NSGRuleComponents[3],
         FlowCountProcessedByRule = NSGRuleComponents[4]
| project NSGName, NSGRuleName, FlowDirection, FlowStatus, FlowCountProcessedByRule

新しい Kusto クエリ:

AzureNetworkAnalytics_CL
| where SubType_s == "FlowLog" and FASchemaVersion_s == "2"
| extend NSGRuleComponents = split(NSGRules_s, "|")
| project NSGName = NSGList_s,
NSGRuleName = NSGRule_s ,
FlowDirection = FlowDirection_s,
FlowStatus = FlowStatus_s,
FlowCountProcessedByRule = AllowedInFlows_d + DeniedInFlows_d + AllowedOutFlows_d + DeniedOutFlows_d

例 3: FlowCount_d フィールド

スキーマはネットワーク セキュリティ グループ間でデータをクラブしないため、 FlowCount_d は次のようになります。

AllowedInFlows_d + DeniedInFlows_d + AllowedOutFlows_d + DeniedOutFlows_d

4 つのフィールドのうち 1 つだけが 0 ではありません。 他の 3 つのフィールドは 0 です。 フィールドは、フローがキャプチャされた NIC のステータスとカウントを示すために入力されます。

これらの条件を説明するには、次のようにします。

  • フローが許可された場合は、接頭辞が付けられた Allowed フィールドのいずれかが入力されます。
  • フローが拒否された場合は、接頭辞が付けられた Denied フィールドのいずれかが入力されます。
  • フローが受信であった場合は、 InFlows_d サフィックス付きフィールドのいずれかが入力されます。
  • フローが送信であった場合は、 OutFlows_d 接尾辞が付けられたフィールドのいずれかが入力されます。

条件に応じて、4 つのフィールドのどれが入力されているかは明らかです。

次のステップ