|
1 | 1 | ---
|
2 |
| -title: Examine WAF logs using Azure Log Analytics |
| 2 | +title: Examining logs using Azure Log Analytics |
3 | 3 | titleSuffix: Azure Application Gateway
|
4 | 4 | description: This article shows you how you can use Azure Log Analytics to examine Application Gateway Web Application Firewall (WAF) logs.
|
5 | 5 | services: application-gateway
|
6 | 6 | author: greg-lindsay
|
7 | 7 | ms.service: azure-application-gateway
|
8 | 8 | ms.topic: troubleshooting
|
9 |
| -ms.date: 07/24/2023 |
| 9 | +ms.date: 09/16/2024 |
10 | 10 | ms.author: greglin
|
11 | 11 | ---
|
12 | 12 |
|
13 |
| -# Use Log Analytics to examine Application Gateway Web Application Firewall (WAF) Logs |
| 13 | +# Use Log Analytics to examine Application Gateway Logs |
14 | 14 |
|
15 |
| -Once your Application Gateway WAF is operational, you can enable logs to inspect what is happening with each request. Firewall logs give insight to what the WAF is evaluating, matching, and blocking. With Log Analytics, you can examine the data inside the firewall logs to give even more insights. For more information about log queries, see [Overview of log queries in Azure Monitor](/azure/azure-monitor/logs/log-query-overview). |
| 15 | +Once your Application Gateway is operational, you can enable logs to inspect the events that occur for your resource. For example, the Application Gateway Firewall logs give insight to what the Web Application Firewall (WAF) is evaluating, matching, and blocking. With Log Analytics, you can examine the data inside the firewall logs to give even more insights. For more information about log queries, see [Overview of log queries in Azure Monitor](/azure/azure-monitor/logs/log-query-overview). |
| 16 | + |
| 17 | +In this article, we will look at the Web Application Firewall (WAF) logs. You can set up [other Application Gateway logs](application-gateway-diagnostics.md) in a similar way. |
16 | 18 |
|
17 | 19 | ## Prerequisites
|
18 | 20 |
|
19 | 21 | * An Azure account with an active subscription is required. If you don't already have an account, you can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
|
20 |
| -* An Azure Web Application Firewall with logs enabled. For more information, see [Azure Web Application Firewall on Azure Application Gateway](../web-application-firewall/ag/ag-overview.md). |
| 22 | +* An Azure Application Gateway WAK SKU. For more information, see [Azure Web Application Firewall on Azure Application Gateway](../web-application-firewall/ag/ag-overview.md). |
21 | 23 | * A Log Analytics workspace. For more information about creating a Log Analytics workspace, see [Create a Log Analytics workspace in the Azure portal](/azure/azure-monitor/logs/quick-create-workspace).
|
22 | 24 |
|
23 |
| -## Import WAF logs |
| 25 | +## Sending logs |
24 | 26 |
|
25 |
| -To import your firewall logs into Log Analytics, see [Backend health, diagnostic logs, and metrics for Application Gateway](application-gateway-diagnostics.md#diagnostic-logging). When you have the firewall logs in your Log Analytics workspace, you can view data, write queries, create visualizations, and add them to your portal dashboard. |
| 27 | +To export your firewall logs into Log Analytics, see [Diagnostic logs for Application Gateway](application-gateway-diagnostics.md#firewall-log). When you have the firewall logs in your Log Analytics workspace, you can view data, write queries, create visualizations, and add them to your portal dashboard. |
26 | 28 |
|
27 | 29 | ## Explore data with examples
|
28 | 30 |
|
29 |
| -To view the raw data in the firewall log, you can run the following query: |
| 31 | +When using **AzureDiagnostics** table, you can view the raw data in the firewall log by running the following query: |
30 | 32 |
|
31 | 33 | ```
|
32 | 34 | AzureDiagnostics
|
33 | 35 | | where ResourceProvider == "MICROSOFT.NETWORK" and Category == "ApplicationGatewayFirewallLog"
|
| 36 | +| limit 10 |
34 | 37 | ```
|
35 | 38 |
|
36 | 39 | This looks similar to the following query:
|
37 | 40 |
|
38 | 41 | :::image type="content" source="media/log-analytics/log-query.png" alt-text="Screenshot of Log Analytics query." lightbox="media/log-analytics/log-query.png":::
|
39 | 42 |
|
40 |
| -You can drill down into the data, and plot graphs or create visualizations from here. See the following queries as a starting point: |
| 43 | +When using **Resource-specific** table, you can view the raw data in the firewall log by running the following query. To know about the resource-specific tables, visit [Monitoring data reference](monitor-application-gateway-reference.md#supported-resource-log-categories-for-microsoftnetworkapplicationgateways). |
| 44 | + |
| 45 | +``` |
| 46 | +AGWFirewallLogs |
| 47 | +| limit 10 |
| 48 | +``` |
| 49 | + |
| 50 | +You can drill down into the data, and plot graphs or create visualizations from here. Here are some more examples of AzureDiagnostics queries that you can use. |
41 | 51 |
|
42 | 52 | ### Matched/Blocked requests by IP
|
43 | 53 |
|
|
0 commit comments