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: 'Tutorial: Add a workspace transformation to Cosmos DB Azure Monitor Logs by using the Azure portal'
3
-
description: Describes how to add a custom transformation to data flowing through Azure Monitor Logs by using the Azure portal.
4
-
ms.topic: tutorial
5
-
ms.date: 03/17/2023
2
+
title: |
3
+
Tutorial: Add a transformation for workspace data
4
+
titleSuffix: Azure Cosmos DB
5
+
description: In this tutorial, add a custom transformation to data flowing through Azure Monitor Logs from Azure Cosmos DB by using the Azure portal.
6
6
author: StefArroyo
7
7
ms.author: esarroyo
8
+
ms.reviewer: sidandrews
8
9
ms.service: cosmos-db
10
+
ms.topic: tutorial
11
+
ms.date: 03/22/2023
9
12
---
10
-
# Cost Optimizations for Log Analytics Workbooks
11
-
To help improve costs for enabling Log Analytics, we now support adding Data Collection Rules and transformations on your Log Analytics resources to filter out columns, reduce number of results returned, and create new columns before the data is sent to the destination.
12
13
14
+
# Tutorial: Add a transformation for Azure Cosmos DB workspace data by using the Azure portal
13
15
14
-
## Tutorial: Add a transformation in a workspace data collection rule by using the Azure portal
15
-
This tutorial walks you through configuration of a sample [transformation in a workspace data collection rule (DCR)](../articles/azure-monitor/essentials/data-collection-transformations.md) by using the Azure portal.
16
+
This tutorial walks you through configuration of a sample [transformation in a workspace data collection rule (DCR)](../azure-monitor/essentials/data-collection-transformations.md) by using the Azure portal.
17
+
18
+
> [!NOTE]
19
+
> To help improve costs for enabling Log Analytics, we now support adding Data Collection Rules and transformations on your Log Analytics resources to filter out columns, reduce number of results returned, and create new columns before the data is sent to the destination.
16
20
17
-
Workspace transformations are stored together in a single [DCR](../articles/azure-monitor/essentials/data-collection-rule-overview.md) for the workspace, which is called the workspace DCR. Each transformation is associated with a particular table. The transformation will be applied to all data sent to this table from any workflow not using a DCR.
21
+
Workspace transformations are stored together in a single [DCR](../azure-monitor/essentials/data-collection-rule-overview.md) for the workspace, which is called the workspace DCR. Each transformation is associated with a particular table. The transformation is applied to all data sent to this table from any workflow not using a DCR.
18
22
19
23
> [!NOTE]
20
-
> This tutorial uses the Azure portal to configure a workspace transformation. For the same tutorial using Azure Resource Manager templates and REST API, see [Tutorial: Add transformation in workspace data collection rule to Azure Monitor using resource manager templates](tutorial-workspace-transformations-api.md).
24
+
> This tutorial uses the Azure portal to configure a workspace transformation. For the same tutorial using Azure Resource Manager templates and REST API, see [Tutorial: Add transformation in workspace data collection rule to Azure Monitor using resource manager templates](../azure-monitor/logs/tutorial-workspace-transformations-api.md).
21
25
22
26
In this tutorial, you learn how to:
23
27
24
28
> [!div class="checklist"]
25
-
> * Configure a [workspace transformation](../articles/azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr) for a table in a Log Analytics workspace.
26
-
> * Write a log query for a workspace transformation.
29
+
>
30
+
> - Configure a [workspace transformation](../azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr) for a table in a Log Analytics workspace.
31
+
> - Write a log query for a workspace transformation.
32
+
>
27
33
28
34
## Prerequisites
35
+
29
36
To complete this tutorial, you need:
30
37
31
-
- A Log Analytics workspace where you have at least [contributor rights](../articles/azure-monitor/logs/manage-access.md#azure-rbac).
32
-
-[Permissions to create DCR objects](../articles/azure-monitor/data-collection-rule-overview.md#permissions) in the workspace.
38
+
- A Log Analytics workspace where you have at least [contributor rights](../azure-monitor/logs/manage-access.md#azure-rbac).
39
+
-[Permissions to create DCR objects](../azure-monitor/essentials/data-collection-rule-overview.md#permissions) in the workspace.
33
40
- A table that already has some data.
34
-
- The table can't be linked to the [workspace transformation DCR](../articles/azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr).
41
+
- The table can't be linked to the [workspace transformation DCR](../azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr).
35
42
36
43
## Overview of the tutorial
37
-
In this tutorial, you'll reduce the storage requirement for the `CDBDataPlaneRequests` table by filtering out certain records. You'll also remove the contents of a column while parsing the column data to store a piece of data in a custom column. The [CDBDataPlaneRequests table](monitor-resource-logs.md) is created when you enable [log analytics](monitor-resource-logs.md) in a workspace.
44
+
45
+
In this tutorial, you reduce the storage requirement for the `CDBDataPlaneRequests` table by filtering out certain records. You also remove the contents of a column while parsing the column data to store a piece of data in a custom column. The [CDBDataPlaneRequests table](monitor-resource-logs.md) is created when you enable [log analytics](monitor-resource-logs.md) in a workspace.
38
46
39
47
This tutorial uses the Azure portal, which provides a wizard to walk you through the process of creating an ingestion-time transformation. After you finish the steps, you'll see that the wizard:
40
48
@@ -43,26 +51,26 @@ This tutorial uses the Azure portal, which provides a wizard to walk you through
43
51
- Creates an ingestion-time transformation and adds it to the DCR.
44
52
45
53
## Enable query audit logs
46
-
You need to enable [log analytics](monitor-resource-logs.md) for your workspace to create the `CDBDataPlaneRequests` table that you'll be working with. This step isn't required for all ingestion time transformations. It's just to generate the sample data that we'll be working with.
54
+
55
+
You need to enable [log analytics](monitor-resource-logs.md) for your workspace to create the `CDBDataPlaneRequests` table that you're working with. This step isn't required for all ingestion time transformations. It's just to generate the sample data that we're working with.
47
56
48
57
## Add a transformation to the table
58
+
49
59
Now that the table's created, you can create the transformation for it.
50
60
51
61
1. On the **Log Analytics workspaces** menu in the Azure portal, select **Tables**. Locate the `CDBDataPlaneRequests` table and select **Create transformation**.
52
62
53
-
:::image type="content" source="media/tutorial-workspace-transformations-portal/create-transformation.png" lightbox="media/tutorial-workspace-transformations-portal/create-transformation.png" alt-text="Screenshot that shows creating a new transformation.":::
54
-
55
-
2. Because this transformation is the first one in the workspace, you must create a [workspace transformation DCR](../articles/azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr). If you create transformations for other tables in the same workspace, they'll be stored in this same DCR. Select **Create a new data collection rule**. The **Subscription** and **Resource group** will already be populated for the workspace. Enter a name for the DCR and select **Done**.
63
+
:::image type="content" source="media/tutorial-log-transformation/create-transformation.png" lightbox="media/tutorial-log-transformation/create-transformation.png" alt-text="Screenshot that shows creating a new transformation.":::
56
64
57
-
:::image type="content" source="media/tutorial-workspace-transformations-portal/new-data-collection-rule.png" lightbox="media/tutorial-workspace-transformations-portal/new-data-collection-rule.png" alt-text="Screenshot that shows creating a new data collection rule.":::
65
+
1. Because this transformation is the first one in the workspace, you must create a [workspace transformation DCR](../azure-monitor/essentials/data-collection-transformations.md#workspace-transformation-dcr). If you create transformations for other tables in the same workspace, they're stored in this same DCR. Select **Create a new data collection rule**. The **Subscription** and **Resource group** are already populated for the workspace. Enter a name for the DCR and select **Done**.
58
66
59
-
3. Select **Next** to view sample data from the table. As you define the transformation, the result will be applied to the sample data. For this reason, you can evaluate the results before you apply it to actual data. Select **Transformation editor** to define the transformation.
67
+
1. Select **Next** to view sample data from the table. As you define the transformation, the result is applied to the sample data. For this reason, you can evaluate the results before you apply it to actual data. Select **Transformation editor** to define the transformation.
60
68
61
-
:::image type="content" source="media/tutorial-workspace-transformations-portal/transformation-query-results.png" lightbox="media/tutorial-workspace-transformations-portal/transformation-query-results.png" alt-text="Screenshot that shows sample data from the log table.":::
69
+
:::image type="content" source="media/tutorial-log-transformation/transformation-query-results.png" lightbox="media/tutorial-log-transformation/transformation-query-results.png" alt-text="Screenshot that shows sample data from the log table.":::
62
70
63
-
4. In the transformation editor, you can see the transformation that will be applied to the data prior to its ingestion into the table. The incoming data is represented by a virtual table named `source`, which has the same set of columns as the destination table itself. The transformation initially contains a simple query that returns the `source` table with no changes.
71
+
1. In the transformation editor, you can see the transformation that is applied to the data prior to its ingestion into the table. A virtual table named `source` represents the incoming data, which has the same set of columns as the destination table itself. The transformation initially contains a simple query that returns the `source` table with no changes.
64
72
65
-
5. Modify the query to the following example:
73
+
1. Modify the query to the following example:
66
74
67
75
```kusto
68
76
source
@@ -78,32 +86,36 @@ Now that the table's created, you can create the transformation for it.
78
86
79
87
> [!Note]
80
88
> Using the Azure portal, the output of the transformation will initiate changes to the table schema if required. Columns will be added to match the transformation output if they don't already exist. Make sure that your output doesn't contain any columns that you don't want added to the table. If the output doesn't include columns that are already in the table, those columns won't be removed, but data won't be added.
81
-
>
89
+
>
82
90
> Any custom columns added to a built-in table must end in `_CF`. Columns added to a custom table don't need to have this suffix. A custom table has a name that ends in `_CL`.
83
91
84
-
6. Copy the query into the transformation editor and select **Run** to view results from the sample data. You can verify that the new `Workspace_CF` column is in the query.
92
+
1. Copy the query into the transformation editor and select **Run** to view results from the sample data. You can verify that the new `Workspace_CF` column is in the query.
85
93
86
-
:::image type="content" source="media/tutorial-workspace-transformations-portal/select-transformation-editor.png" lightbox="media/tutorial-workspace-transformations-portal/select-transformation-editor.png" alt-text="Screenshot that shows the transformation editor.":::
94
+
:::image type="content" source="media/tutorial-log-transformation/select-transformation-editor.png" lightbox="media/tutorial-log-transformation/select-transformation-editor.png" alt-text="Screenshot that shows the transformation editor.":::
87
95
88
-
6. Select **Apply** to save the transformation and then select **Next** to review the configuration. Select **Create** to update the DCR with the new transformation.
96
+
1. Select **Apply** to save the transformation and then select **Next** to review the configuration. Select **Create** to update the DCR with the new transformation.
89
97
90
-
:::image type="content" source="media/tutorial-workspace-transformations-portal/transformation-configuration-created.png" lightbox="media/tutorial-workspace-transformations-portal/transformation-configuration-created.png" alt-text="Screenshot that shows saving the transformation.":::
98
+
:::image type="content" source="media/tutorial-log-transformation/transformation-configuration-created.png" lightbox="media/tutorial-log-transformation/transformation-configuration-created.png" alt-text="Screenshot that shows saving the transformation.":::
91
99
92
100
## Test the transformation
93
-
Allow about 30 minutes for the transformation to take effect and then test it by running a query against the table. Only data sent to the table after the transformation was applied will be affected.
101
+
102
+
Allow about 30 minutes for the transformation to take effect and then test it by running a query against the table. This transformation affects only data sent to the table after the transformation was applied.
94
103
95
104
For this tutorial, run some sample queries to send data to the `CDBDataPlaneRequests` table. Include some queries against `CDBDataPlaneRequests` so that you can verify that the transformation filters these records.
96
105
97
106
## Troubleshooting
107
+
98
108
This section describes different error conditions you might receive and how to correct them.
99
109
100
110
### IntelliSense in Log Analytics not recognizing new columns in the table
111
+
101
112
The cache that drives IntelliSense might take up to 24 hours to update.
102
113
103
114
### Transformation on a dynamic column isn't working
115
+
104
116
A known issue currently affects dynamic columns. A temporary workaround is to explicitly parse dynamic column data by using `parse_json()` prior to performing any operations against them.
105
117
106
118
## Next steps
107
119
108
-
- [Read more about transformations](../articles/azure-monitor/essentials/data-collection-transformations.md)
109
-
- [Learn more about writing transformation queries](../articles/azure-monitor/essentials/data-collection-transformations-structure.md)
0 commit comments