You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Collect text logs with Azure Monitor agent (preview)
2
+
title: Collect text and IIS logs with Azure Monitor agent (preview)
3
3
description: Configure collection of filed-based text logs using a data collection rule on virtual machines with the Azure Monitor agent.
4
4
ms.topic: conceptual
5
-
ms.date: 04/08/2022
5
+
ms.date: 04/15/2022
6
6
7
7
---
8
8
9
-
# Collect text logs with Azure Monitor agent (preview)
10
-
This tutorial shows you how to configure the collection of file-based text logswith the [Azure Monitor agent](azure-monitor-agent-overview.md) and sending the collected data to a custom table in a Log Analytics workspace. This feature uses a [data collection rule](../essentials/data-collection-rule-overview.md) that you can use to define the structure of the log file and its target table.
9
+
# Collect text and IIS logs with Azure Monitor agent (preview)
10
+
This article describes how to configure the collection of file-based text logs, including logs generated by IIS on Windows computers, with the [Azure Monitor agent](azure-monitor-agent-overview.md). Many applications log information to text files instead of standard logging services such as Windows Event log or Syslog.
11
11
12
12
> [!NOTE]
13
13
> This feature is currently in public preview and isn't completely implemented in the Azure portal. This tutorial uses Azure Resource Manager templates for steps that can't yet be performed with the portal.
14
14
15
-
In this tutorial, you learn to:
16
-
17
-
> [!div class="checklist"]
18
-
> * Create a custom table in a Log Analytics workspace.
19
-
> * Create a data collection endpoint to receive data from an agent.
20
-
> * Create a data collection rule that collects data from both a custom text log file.
21
-
> * Create an association to apply the data collection rule to agents.
22
15
## Prerequisites
23
-
To complete this tutorial, you need the following:
16
+
To complete this procedure, you need the following:
24
17
25
18
- Log Analytics workspace where you have at least [contributor rights](../logs/manage-access.md#manage-access-using-azure-permissions) .
26
19
-[Permissions to create Data Collection Rule objects](/azure/azure-monitor/essentials/data-collection-rule-overview#permissions) in the workspace.
27
20
- An agent with supported log file as described in the next section.
28
21
29
22
## Log files supported
30
-
The log file must meet the following criteria to be collected by this feature:
23
+
IIS logs must be in W3C format. Other log files must meet the following criteria to be collected:
31
24
32
25
- The log file must be stored on a local drive of a virtual machine, virtual machine scale set, or Arc enabled server with the Azure Monitor installed.
33
26
- Each entry in the log file must be delineated with an [ISO 8601 formatted](https://www.iso.org/standard/40874.html) time stamp or an end of line.
@@ -37,15 +30,18 @@ The log file must meet the following criteria to be collected by this feature:
37
30
## Steps to collect text logs
38
31
The steps to configure log collection are as follows. The detailed steps for each are provided in the sections below:
39
32
40
-
1. Create a new table in your workspace to receive the collected data.
33
+
1. Create a new table in your workspace to receive the collected data. (not required for IIS logs)
41
34
2. Create a data collection endpoint for the Azure Monitor agent to connect.
42
35
3. Create a data collection rule to define the structure of the log file and destination of the collected data.
43
36
4. Create association between the data collection rule and the agent collecting the log file.
44
37
45
38
## Create new table in Log Analytics workspace
46
39
The custom table must be created before you can send data to it. When you create the table, you provide its name and a definition for each of its columns.
47
40
48
-
Use the **Tables - Update** API to create the table with the PowerShell code below. This code creates a table called *MyTable_CL* with two columns. You can modify this schema to collect a different table.
41
+
>[!NOTE]
42
+
> This step isn't required to collect an IIS log. The table [W3CIISLog](/azure/azure-monitor/reference/tables/w3ciislog) will be used for IIS logs.
43
+
44
+
Use the **Tables - Update** API to create the table with the PowerShell code below. This code creates a table called *MyTable_CL* with two columns. Modify this schema to collect a different table.
49
45
50
46
> [!IMPORTANT]
51
47
> Custom tables must use a suffix of *_CL*.
@@ -96,7 +92,6 @@ A [data collection endpoint (DCE)](../essentials/data-collection-endpoint-overvi
96
92
97
93
:::image type="content" source="../logs/media/tutorial-ingestion-time-transformations-api/edit-template.png" lightbox="../logs/media/tutorial-ingestion-time-transformations-api/edit-template.png" alt-text="Screenshot that shows portal blade to edit Resource Manager template.":::
@@ -143,6 +138,7 @@ A [data collection endpoint (DCE)](../essentials/data-collection-endpoint-overvi
143
138
}
144
139
```
145
140
141
+
146
142
4. On the **Custom deployment** screen, specify a **Subscription** and **Resource group** to store the data collection rule and then provide values a **Name** for the data collection endpoint. The **Location** should be the same location as the workspace. The **Region** will already be populated and is used for the location of the data collection endpoint.
147
143
148
144
:::image type="content" source="../logs/media/tutorial-ingestion-time-transformations-api/custom-deployment-values.png" lightbox="../logs/media/tutorial-ingestion-time-transformations-api/custom-deployment-values.png" alt-text="Screenshot that shows portal blade to edit custom deployment values for data collection endpoint.":::
@@ -173,19 +169,18 @@ The [data collection rule (DCR)](../essentials/data-collection-rule-overview.md)
173
169
174
170
:::image type="content" source="../logs/media/tutorial-ingestion-time-transformations-api/build-custom-template.png" lightbox="../logs/media/tutorial-ingestion-time-transformations-api/build-custom-template.png" alt-text="Screenshot that shows portal blade to build template in the editor.":::
175
171
176
-
3. Paste the Resource Manager template below into the editor and then change the following values:
177
-
178
-
You may choose to modify the following details in the DCR defined in this template:
172
+
3. Paste one of the Resource Manager templates below into the editor and then change the following values:
179
173
180
174
- `streamDeclarations`: Defines the columns of the incoming data. This must match the structure of the log file.
181
175
- `filePatterns`: Specifies the location and file pattern of the log files to collect. This defines a separate pattern for Windows and Linux agents.
182
-
- `transformKql`: Specifies a [transformation](../logs/../essentials/data-collection-rule-transformations.md) to apply to the incoming data before it's sent to the workspace. Since data collection rules for Azure Monitor agent don't yet support transformations, this value will always be `source`.
176
+
- `transformKql`: Specifies a [transformation](../logs/../essentials/data-collection-rule-transformations.md) to apply to the incoming data before it's sent to the workspace. Data collection rules for Azure Monitor agent don't yet support transformations, so this value should currently be `source`.
183
177
184
178
185
179
4. Click **Save**.
186
180
187
181
:::image type="content" source="../logs/media/tutorial-ingestion-time-transformations-api/edit-template.png" lightbox="../logs/media/tutorial-ingestion-time-transformations-api/edit-template.png" alt-text="Screenshot that shows portal blade to edit Resource Manager template.":::
188
182
183
+
**Data collection rule for text log**
189
184
190
185
```json
191
186
{
@@ -235,7 +230,7 @@ The [data collection rule (DCR)](../essentials/data-collection-rule-overview.md)
5. On the **Custom deployment** screen, specify a **Subscription** and **Resource group** to store the data collection rule and then provide values defined in the template. This includes a **Name** for the data collection rule and the **Workspace Resource ID** and **Endpoint Resource ID**. The **Location** should be the same location as the workspace. The **Region** will already be populated and is used for the location of the data collection rule.
322
412
323
413
:::image type="content" source="media/data-collection-text-log/custom-deployment-values.png" lightbox="media/data-collection-text-log/custom-deployment-values.png" alt-text="Screenshot that shows portal blade to edit custom deployment values for data collection rule.":::
0 commit comments