|
| 1 | +--- |
| 2 | +title: Enable Top 10 flows and Flow trace logs in Azure Firewall |
| 3 | +description: Learn how to enable the Top 10 flows and Flow trace logs in Azure Firewall |
| 4 | +services: firewall |
| 5 | +author: vhorne |
| 6 | +ms.service: firewall |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 03/27/2023 |
| 9 | +ms.author: victorh |
| 10 | +--- |
| 11 | + |
| 12 | +# Enable Top 10 flows (preview) and Flow trace logs (preview) in Azure Firewall |
| 13 | + |
| 14 | +Azure Firewall has two new diagnostics logs you can use to help monitor your firewall: |
| 15 | + |
| 16 | +- Top 10 flows |
| 17 | +- Flow trace |
| 18 | + |
| 19 | +## Top 10 flows |
| 20 | + |
| 21 | +The Top 10 flows log (known in the industry as Fat Flows), shows the top connections that are contributing to the highest throughput through the firewall. |
| 22 | + |
| 23 | +### Prerequisites |
| 24 | + |
| 25 | +- Enable [structured logs](firewall-structured-logs.md#enabledisable-structured-logs) |
| 26 | +- Use the Azure Resource Specific Table format in [Diagnostic Settings](firewall-diagnostics.md#enable-diagnostic-logging-through-the-azure-portal). |
| 27 | + |
| 28 | +### Enable the log |
| 29 | + |
| 30 | +Enable the log using the following Azure PowerShell commands: |
| 31 | + |
| 32 | +```azurepowershell |
| 33 | +Set-AzContext -SubscriptionName <SubscriptionName> |
| 34 | +$firewall = Get-AzFirewall- ResourceGroupName <ResourceGroupName> -Name <FirewallName> |
| 35 | +$firewall.EnableFatFlowLogging = $true |
| 36 | +Set-AzFirewall -AzureFirewall $firewall |
| 37 | +``` |
| 38 | +### Verify the update |
| 39 | + |
| 40 | +There are a few ways to verify the update was successful, but you can navigate to firewall **Overview** and select **JSON view** on the top right corner. Here’s an example: |
| 41 | + |
| 42 | +:::image type="content" source="media/enable-top-ten-and-flow-trace/firewall-log-verification.png" alt-text="Screenshot of JSON showing additional log verification."::: |
| 43 | + |
| 44 | +### Create a diagnostic setting and enable Resource Specific Table |
| 45 | + |
| 46 | +1. In the Diagnostic settings tab, select **Add diagnostic setting**. |
| 47 | +2. Type a Diagnostic setting name. |
| 48 | +3. Select **Azure Firewall Fat Flow Log** under **Categories** and any other logs you want to be supported in the firewall. |
| 49 | +4. In Destination details, select **Send to Log Analytics** workspace |
| 50 | + 1. Choose your desired Subscription and preconfigured Log Analytics workspace. |
| 51 | + 1. Enable **Resource specific**. |
| 52 | + :::image type="content" source="media/enable-top-ten-and-flow-trace/log-destination-details.png" alt-text="Screenshot showing log destination details."::: |
| 53 | + |
| 54 | +### View and analyze Azure Firewall logs |
| 55 | + |
| 56 | +1. On a firewall resource, navigate to **Logs** under the **Monitoring** tab. |
| 57 | +2. Select **Queries**, then load **Azure Firewall Top Flow Logs** by hovering over the option and selecting **Load to editor**. |
| 58 | +3. When the query loads, select **Run**. |
| 59 | + |
| 60 | + :::image type="content" source="media/enable-top-ten-and-flow-trace/top-ten-flow-log.png" alt-text="Screenshot showing the Top 10 flow log." lightbox="media/enable-top-ten-and-flow-trace/top-ten-flow-log.png"::: |
| 61 | + |
| 62 | +## Flow trace |
| 63 | + |
| 64 | +Currently, the firewall logs show traffic through the firewall in the first attempt of a TCP connection, known as the *syn* packet. However, this doesn't show the full journey of the packet in the TCP handshake. As a result, it's difficult to troubleshoot if a packet is dropped, or asymmetric routing has occurred. |
| 65 | + |
| 66 | +The following additional properties can be added: |
| 67 | +- SYN-ACK |
| 68 | +- FIN |
| 69 | +- FIN-ACK |
| 70 | +- RST |
| 71 | +- INVALID (flows) |
| 72 | + |
| 73 | +### Prerequisites |
| 74 | + |
| 75 | +- Enable [structured logs](firewall-structured-logs.md#enabledisable-structured-logs) |
| 76 | +- Use the Azure Resource Specific Table format in [Diagnostic Settings](firewall-diagnostics.md#enable-diagnostic-logging-through-the-azure-portal). |
| 77 | + |
| 78 | +### Enable the log |
| 79 | + |
| 80 | +Enable the log using the following Azure PowerShell commands: |
| 81 | + |
| 82 | +```azurepowershell |
| 83 | +Connect-AzAccount |
| 84 | +Select-AzSubscription -Subscription <subscription_id> or <subscription_name> |
| 85 | +Register-AzProviderFeature -FeatureName AFWEnableTcpConnectionLogging -ProviderNamespace Microsoft.Network |
| 86 | +Register-AzResourceProvider -ProviderNamespace Microsoft.Network |
| 87 | +``` |
| 88 | +### Create a diagnostic setting and enable Resource Specific Table |
| 89 | + |
| 90 | +1. In the Diagnostic settings tab, select **Add diagnostic setting**. |
| 91 | +2. Type a Diagnostic setting name. |
| 92 | +3. Select **Azure Firewall Fat Flow Log** under **Categories** and any other logs you want to be supported in the firewall. |
| 93 | +4. In Destination details, select **Send to Log Analytics** workspace |
| 94 | + 1. Choose your desired Subscription and preconfigured Log Analytics workspace. |
| 95 | + 1. Enable **Resource specific**. |
| 96 | + :::image type="content" source="media/enable-top-ten-and-flow-trace/log-destination-details.png" alt-text="Screenshot showing log destination details."::: |
| 97 | + |
| 98 | +### View and analyze Azure Firewall Flow trace logs |
| 99 | + |
| 100 | +1. On a firewall resource, navigate to **Logs** under the **Monitoring** tab. |
| 101 | +2. Select **Queries**, then load **Azure Firewall flow trace logs** by hovering over the option and selecting **Load to editor**. |
| 102 | +3. When the query loads, select **Run**. |
| 103 | + |
| 104 | + :::image type="content" source="media/enable-top-ten-and-flow-trace/trace-flow-logs.png" alt-text="Screenshot showing the Trace flow log." lightbox="media/enable-top-ten-and-flow-trace/trace-flow-logs.png"::: |
| 105 | + |
| 106 | + |
| 107 | +## Next steps |
| 108 | + |
| 109 | +- [Azure Structured Firewall Logs (preview)](firewall-structured-logs.md) |
0 commit comments