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
Copy file name to clipboardExpand all lines: articles/azure-monitor/essentials/data-collection-rule-create-edit.md
+43-36Lines changed: 43 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,34 +10,40 @@ ms.custom: references_regions
10
10
---
11
11
12
12
# Create and edit data collection rules (DCRs) in Azure Monitor
13
-
There are multiple methods for creating a [data collection rule (DCR)](./data-collection-rule-overview.md) in Azure Monitor. In some cases, Azure Monitor will create and manage the DCR according to settings that you configure in the Azure portal. In other cases, you might need to create your own DCRs to customize particular scenarios.
13
+
14
+
There are multiple methods for creating a [data collection rule (DCR)](./data-collection-rule-overview.md) in Azure Monitor. In some cases, Azure Monitor can create and manage the DCR according to settings that you configure in the Azure portal. In other cases, you need to create your own DCRs to customize particular scenarios.
14
15
15
16
This article describes the different methods for creating and editing a DCR. For the contents of the DCR itself, see [Structure of a data collection rule in Azure Monitor](./data-collection-rule-structure.md).
16
17
17
18
## Permissions
19
+
18
20
You require the following permissions to create DCRs and associations:
19
21
20
22
| Built-in role | Scopes | Reason |
21
23
|:---|:---|:---|
22
24
|[Monitoring Contributor](../../role-based-access-control/built-in-roles.md#monitoring-contributor)| <ul><li>Subscription and/or</li><li>Resource group and/or </li><li>An existing DCR</li></ul> | Create or edit DCRs, assign rules to the machine, deploy associations. |
|[Virtual Machine Contributor](../../role-based-access-control/built-in-roles.md#virtual-machine-contributor)<br>[Azure Connected Machine Resource Administrator](../../role-based-access-control/built-in-roles.md#azure-connected-machine-resource-administrator)</li></ul> | <ul><li>Virtual machines, virtual machine scale sets</li><li>Azure Arc-enabled servers</li></ul> | Deploy agent extensions on the VM (virtual machine). |
24
26
| Any role that includes the action *Microsoft.Resources/deployments/**| <ul><li>Subscription and/or</li><li>Resource group and/or </li><li>An existing DCR</li></ul> | Deploy Azure Resource Manager templates. |
25
27
26
28
## Automated methods to create a DCR
27
-
The following table lists methods to create data collection scenarios using the Azure portal where the DCR is created for you. In these cases you don't need to interact directly with the DCR itself.
29
+
30
+
The following table lists methods to create data collection scenarios using the Azure portal where the DCR is created for you. In these cases, you don't need to interact directly with the DCR itself.
28
31
29
32
| Scenario | Resources | Description |
30
33
|:---|:---|:---|
31
-
| Monitor a virtual machine |[Enable VM insights overview](../vm/vminsights-enable-overview.md)| When you enable VM insights on a VM, the Azure Monitor agent is installed, and a DCR is created that collects a predefined set of performance counters. You shouldn't modify this DCR. |
32
-
| Container insights |[Enable Container insights](../containers/kubernetes-monitoring-enable.md#enable-prometheus-and-grafana)| When you enable Container insights on a Kubernetes cluster, a containerized version of the Azure Monitor agent is installed, and a DCR is created that collects data according to the configuration you selected. You may need to modify this DCR to add a transformation. |
33
-
| Workspace transformation |[Add a transformation in a workspace data collection rule using the Azure portal](../logs/tutorial-workspace-transformations-portal.md)| Create a transformation for any supported table in a Log Analytics workspace. The transformation is defined in a DCR that's then associated with the workspace. It's applied to any data sent to that table from a legacy workload that doesn't already use a DCR. |
34
-
34
+
| Monitor a virtual machine |[Enable VM Insights overview](../vm/vminsights-enable-overview.md)| When you enable VM Insights on a VM, the Azure Monitor agent is installed and a DCR is created. This DCR collects a predefined set of performance counters and shouldn't be modified. |
35
+
| Container insights |[Enable Container Insights](../containers/kubernetes-monitoring-enable.md#enable-prometheus-and-grafana)| When you enable Container Insights on a Kubernetes cluster, a containerized version of the Azure Monitor agent is installed, and a DCR is created that collects data according to the configuration you selected. You may need to modify this DCR to add a transformation. |
36
+
| Workspace transformation |[Add a transformation in a workspace data collection rule using the Azure portal](../logs/tutorial-workspace-transformations-portal.md)| Create a transformation for any supported table in a Log Analytics workspace. This transformation is specified within a DCR, which is linked to the workspace. The transformation is then applied to any data sent to that table from any legacy workloads that don't yet utilize DCR. |
35
37
36
38
## Create a DCR
37
39
38
-
Azure provides a centralized cloud based data collection configuration plan for virtual machines, virtual machine scale sets, On-Prem machines and Prometheus metrics from containers.
40
+
Azure provides a centralized cloud based data collection configuration plan for virtual machines, virtual machine scale sets, on-premises machines, and Prometheus metrics from containers.
41
+
42
+
This article explains how to create a DCR from scratch. There are other solutions, such as Sentinel, VM Insights, and Application Insights, that offer DCR creation as part of their workflows. Sometimes, the DCRs created by these different solutions may appear to conflict. There are three tables where Windows events can be directed:
39
43
40
-
This article describes how to create a DCR from scratch. There are other insights solution that provide DCR creation experiences like Sentinel, VM insights, and Application Insights that create DCRs as part of there own workflows. Some time the DCRs created in these by different solution can seem to conflict. There are three tables to which Windows events can be sent to. Sentinel security audit events with go to SecurityEvents, WEF connector events go to the WindowsEvent table. If you use the scratch Windows event collection the results go to the Event table.
44
+
* Sentinel security audit events are sent to the SecurityEvents table.
45
+
* Windows Event Forwarding (WEF) connector events go to the WindowsEvent table.
46
+
* Events collected from scratch using the Windows event collection are sent to the Event table.
41
47
42
48
To create a data collection rule using the Azure CLI, PowerShell, API, or ARM templates, create a JSON file, starting with one of the [sample DCRs](./data-collection-rule-samples.md). Use information in [Structure of a data collection rule in Azure Monitor](./data-collection-rule-structure.md) to modify the JSON file for your particular environment and requirements.
43
49
@@ -47,10 +53,10 @@ To create a data collection rule using the Azure CLI, PowerShell, API, or ARM te
47
53
## [Portal](#tab/portal)
48
54
49
55
On the **Monitor** menu, select **Data Collection Rules** > **Create** to open the page to create a new data collection rule.
50
-
56
+
51
57
:::image type="content" source="media/data-collection-rule-create-edit/data-collection-rules-updated.png" lightbox="media/data-collection-rule-create-edit/data-collection-rules-updated.png" alt-text="Screenshot that shows the Create button on the Data Collection Rules screen." border="false":::
52
58
53
-
Configure the settings in each step of the wizard, as detailed below.
59
+
Configure the settings in each step of the wizard, as detailed in the following section.
54
60
55
61
### Basics
56
62
@@ -71,20 +77,20 @@ Configure the settings in each step of the wizard, as detailed below.
71
77
72
78
| Screen element | Description |
73
79
|:---|:---|
74
-
|**+ Add resources**| Associate virtual machines, Virtual Machine Scale Sets, and Azure Arc for servers to the data collection rule. The Azure portal installs Azure Monitor Agent on resources that don't already have the agent installed.|
75
-
|**Enable Data Collection Endpoints**| If the machine you're monitoring is not in the same region as your destination Log Analytics workspace, enable data collection endpoints and select an endpoint in the region of the monitored machine to collect **Linux syslog data**, **IIS logs**, **custom text logs** or **custom JSON logs**.<br>If the monitored machine is in the same region as your destination Log Analytics workspace, or if you're collecting performance counters and Windows event logs, don't select a data collection endpoint on the **Resources** tab.<br>The data collection endpoint on the **Resources** tab is the configuration access endpoint, as described in [Components of a data collection endpoint](../essentials/data-collection-endpoint-overview.md#components-of-a-dce).<br>If you need network isolation using private links, select existing endpoints from the same region for the respective resources or [create a new endpoint](../essentials/data-collection-endpoint-overview.md).|
76
-
|**Agent extension identity**| Use a system-assigned managed identity, or select an existing user-assigned identity assigned to the virtual machine. For more information, see [Managed identity types](/entra/identity/managed-identities-azure-resources/overview#managed-identity-types).|
80
+
|**+ Add resources**| Associate virtual machines, Virtual Machine Scale Sets, and Azure Arc for servers to the data collection rule. The Azure portal installs Azure Monitor Agent on resources that don't already have the agent installed.|
81
+
|**Enable Data Collection Endpoints**| If the machine you're monitoring isn't in the same region as your destination Log Analytics workspace, enable data collection endpoints and select an endpoint in the region of the monitored machine to collect **Linux syslog data**, **IIS logs**, **custom text logs**, or **custom JSON logs**.<br>If the monitored machine is in the same region as your destination Log Analytics workspace, or if you're collecting performance counters and Windows event logs, don't select a data collection endpoint on the **Resources** tab.<br>The data collection endpoint on the **Resources** tab is the configuration access endpoint, as described in [Components of a data collection endpoint](../essentials/data-collection-endpoint-overview.md#components-of-a-dce).<br>If you need network isolation using private links, select existing endpoints from the same region for the respective resources or [create a new endpoint](../essentials/data-collection-endpoint-overview.md).|
82
+
|**Agent extension identity**| Use a system-assigned managed identity, or select an existing user-assigned identity assigned to the virtual machine. For more information, see [Managed identity types](/entra/identity/managed-identities-azure-resources/overview#managed-identity-types).|
77
83
78
84
### Collect and deliver
79
85
80
-
On the **Collect and deliver** tab, select **Add data source** and configure the settings on the **Source** and **Destination** tabs, as detailed below.
86
+
On the **Collect and deliver** tab, select **Add data source** and configure the settings on the **Source** and **Destination** tabs.
81
87
82
88
:::image type="content" source="media/data-collection-rule-create-edit/data-collection-rule-data-source-destination.png" lightbox="media/data-collection-rule-create-edit/data-collection-rule-data-source-destination.png" alt-text="Screenshot that shows the Collect and deliver tab of the Data Collection Rule wizard. On this tab, you define which data source Azure Monitor Agent collects data from and where the agent sends the data." border="false":::
83
89
84
90
| Screen element | Description |
85
91
|:---|:---|
86
-
|**Data source**| Select a **Data source type** and define related fields based on the data source type you select. For more information about collecting data from the various data source types, see [Collect data with Azure Monitor Agent](../agents/azure-monitor-agent-data-collection.md)|
87
-
|**Destination**| Add one or more destinations for each source. You can select multiple destinations of the same or different types. |
92
+
|**Data source**| Select a **Data source type** and define related fields based on the data source type you select. For more information about collecting data from the various data source types, see [Collect data with Azure Monitor Agent](../agents/azure-monitor-agent-data-collection.md)|
93
+
|**Destination**| Add one or more destinations for each source. You can select multiple destinations of the same or different types. |
Use the [New-AzDataCollectionRule](/powershell/module/az.monitor/new-azdatacollectionrule) cmdlet to create the DCR from your JSON file using PowerShell as shown in the following example.
105
111
106
112
```powershell
107
-
New-AzDataCollectionRule -Location 'east-us' -ResourceGroupName 'my-resource-group' -RuleName 'myDCRName' -RuleFile 'C:\MyNewDCR.json' -Description 'This is my new DCR'
| Get associations |[Get-AzDataCollectionRuleAssociation](/powershell/module/az.monitor/get-azdatacollectionruleassociation)|
131
+
| Create an association |[New-AzDataCollectionRuleAssociation](/powershell/module/az.monitor/new-azdatacollectionruleassociation)|
126
132
| Delete an association |[Remove-AzDataCollectionRuleAssociation](/powershell/module/az.monitor/remove-azdatacollectionruleassociation)|
127
133
128
134
### [API](#tab/api)
129
-
Use the [DCR create API](/rest/api/monitor/data-collection-rules/create) to create the DCR from your JSON file. You can use any method to call a REST API as shown in the following examples.
130
135
136
+
Use the [DCR create API](/rest/api/monitor/data-collection-rules/create) to create the DCR from your JSON file. You can use any method to call a REST API as shown in the following examples.
Use the following template to create a DCR using information from [Structure of a data collection rule in Azure Monitor](./data-collection-rule-structure.md) and [Sample data collection rules (DCRs) in Azure Monitor](./data-collection-rule-samples.md) to define the `dcr-properties`.
154
158
@@ -186,6 +190,7 @@ Use the following template to create a DCR using information from [Structure of
186
190
```
187
191
188
192
#### DCR Association -Azure VM
193
+
189
194
The following sample creates an association between an Azure virtual machine and a data collection rule.
190
195
191
196
**Bicep template file**
@@ -274,7 +279,9 @@ resource association 'Microsoft.Insights/dataCollectionRuleAssociations@2021-09-
274
279
}
275
280
}
276
281
```
282
+
277
283
### DCR Association -Arc-enabled server
284
+
278
285
The following sample creates an association between an Azure Arc-enabled server and a data collection rule.
279
286
280
287
**Bicep template file**
@@ -365,8 +372,8 @@ resource association 'Microsoft.Insights/dataCollectionRuleAssociations@2021-09-
365
372
```
366
373
---
367
374
368
-
369
375
## Edit a DCR
376
+
370
377
To edit a DCR, you can use any of the methods described in the previous section to create a DCR using a modified version of the JSON.
371
378
372
379
If you need to retrieve the JSON for an existing DCR, you can copy it from the **JSON View** for the DCR in the Azure portal. You can also retrieve it using an API call as shown in the following PowerShell example.
@@ -382,5 +389,5 @@ For a tutorial that walks through the process of retrieving and then editing an
382
389
383
390
## Next steps
384
391
385
-
-[Read about the detailed structure of a data collection rule](data-collection-rule-structure.md)
386
-
-[Get details on transformations in a data collection rule](data-collection-transformations.md)
392
+
*[Read about the detailed structure of a data collection rule](data-collection-rule-structure.md)
393
+
*[Get details on transformations in a data collection rule](data-collection-transformations.md)
0 commit comments