Skip to content

Commit 37ace21

Browse files
authored
Merge pull request #218847 from bwren/transforms
Transformations multiple destinations
2 parents 4373589 + 4f850cf commit 37ace21

File tree

2 files changed

+234
-3
lines changed

2 files changed

+234
-3
lines changed

articles/azure-monitor/essentials/data-collection-transformations.md

Lines changed: 234 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ The following table describes the different goals that transformations can be us
1515

1616
| Category | Details |
1717
|:---|:---|
18-
| Remove sensitive data | You may have a data source that sends information you don't want stored for privacy or compliancy reasons.<br><br>**Filter sensitive information.** Filter out entire rows or just particular columns that contain sensitive information.<br><br>**Obfuscate sensitive information**. For example, you might replace digits with a common character in an IP address or telephone number. |
18+
| Remove sensitive data | You may have a data source that sends information you don't want stored for privacy or compliancy reasons.<br><br>**Filter sensitive information.** Filter out entire rows or just particular columns that contain sensitive information.<br><br>**Obfuscate sensitive information**. Replace information such as digits in an IP address or telephone number with a common character.<br><br>**Send to alternate table.** Send sensitive records to an alternate table with different RBAC configuration. |
1919
| Enrich data with additional or calculated information | Use a transformation to add information to data that provides business context or simplifies querying the data later.<br><br>**Add a column with additional information.** For example, you might add a column identifying whether an IP address in another column is internal or external.<br><br>**Add business specific information.** For example, you might add a column indicating a company division based on location information in other columns. |
20-
| Reduce data costs | Since you're charged ingestion cost for any data sent to a Log Analytics workspace, you want to filter out any data that you don't require to reduce your costs.<br><br>**Remove entire rows.** For example, you might have a diagnostic setting to collect resource logs from a particular resource but not require all of the log entries that it generates. Create a transformation that filters out records that match a certain criteria.<br><br>**Remove a column from each row.** For example, your data may include columns with data that's redundant or has minimal value. Create a transformation that filters out columns that aren't required.<br><br>**Parse important data from a column.** You may have a table with valuable data buried in a particular column. Use a transformation to parse the valuable data into a new column and remove the original. |
20+
| Reduce data costs | Since you're charged ingestion cost for any data sent to a Log Analytics workspace, you want to filter out any data that you don't require to reduce your costs.<br><br>**Remove entire rows.** For example, you might have a diagnostic setting to collect resource logs from a particular resource but not require all of the log entries that it generates. Create a transformation that filters out records that match a certain criteria.<br><br>**Remove a column from each row.** For example, your data may include columns with data that's redundant or has minimal value. Create a transformation that filters out columns that aren't required.<br><br>**Parse important data from a column.** You may have a table with valuable data buried in a particular column. Use a transformation to parse the valuable data into a new column and remove the original.<br><br>**Send certain rows to basic logs.** Send rows in your data that require on basic query capabilities to basic logs tables for a lower ingestion cost. |
2121

2222

2323

@@ -50,20 +50,36 @@ A common use of the workspace transformation DCR is collection of [resource logs
5050

5151
:::image type="content" source="media/data-collection-transformations/transformation-diagnostic-settings.png" lightbox="media/data-collection-transformations/transformation-diagnostic-settings.png" alt-text="Diagram of workspace transformation for resource logs configured with diagnostic settings." border="false":::
5252

53+
## Multiple destinations
54+
55+
Transformations allow you to send data to multiple destinations in a Log Analytics workspace using a single DCR. You provide a KQL query for each destination, and the results of each query are sent to their corresponding location. You can send different sets of data to different tables, or use multiple queries to send different sets of data to the same table.
56+
57+
For example, you may send event data into Azure Monitor using the Logs ingestion API. Most of the events should be sent an analytics table where it could be queried regularly, while audit events should be sent to a custom table configured for [basic logs](../logs/basic-logs-configure.md) to reduce your cost.
58+
59+
To use multiple destinations, you must currently either manually create a new DCR or [edit an existing one](data-collection-rule-edit.md). See the [Samples](#samples) section for examples of DCRs using multiple destinations.
60+
61+
> [!IMPORTANT]
62+
> Currently, the tables in the DCR must be in the same Log Analytics workspace. To send to multiple workspaces from a single data source, use multiple DCRs and configure your application to send the data to each.
63+
64+
:::image type="content" source="media/data-collection-transformations/transformation-multiple-destinations.png" lightbox="media/data-collection-transformations/transformation-multiple-destinations.png" alt-text="Diagram of transformation sending data to multiple tables." border="false":::
65+
66+
67+
5368
## Creating a transformation
5469
There are multiple methods to create transformations depending on the data collection method. The following table lists guidance for different methods for creating transformations.
5570

5671
| Type | Reference |
5772
|:---|:---|
5873
| Logs ingestion API with transformation | [Send data to Azure Monitor Logs using REST API (Azure portal)](../logs/tutorial-logs-ingestion-portal.md)<br>[Send data to Azure Monitor Logs using REST API (Resource Manager templates)](../logs/tutorial-logs-ingestion-api.md) |
59-
| Transformation in workspace DCR | [Add workspace transformation to Azure Monitor Logs using the Azure portal](../logs/tutorial-workspace-transformations-portal.md)<br>[Add workspace transformation to Azure Monitor Logs using resource manager templates](../logs/tutorial-workspace-transformations-api.md)
74+
| Transformation in workspace DCR | [Add workspace transformation to Azure Monitor Logs using the Azure portal](../logs/tutorial-workspace-transformations-portal.md)<br>[Add workspace transformation to Azure Monitor Logs using Resource Manager templates](../logs/tutorial-workspace-transformations-api.md)
6075

6176
## Cost for transformations
6277
There is no direct cost for transformations, but you may incur charges for the following:
6378

6479
- If your transformation increases the size of the incoming data, adding a calculated column for example, then you're charged at the normal rate for ingestion of that additional data.
6580
- If your transformation reduces the incoming data by more than 50%, then you're charged for ingestion of the amount of filtered data above 50%.
6681

82+
6783
The formula to determine the filter ingestion charge from transformations is `[GB filtered out by transformations] - ( [Total GB ingested] / 2 )`. For example, suppose that you ingest 100 GB on a particular day, and transformations remove 70 GB. You would be charged for 70 GB - (100 GB / 2) or 20 GB. To avoid this charge, you should use other methods to filter incoming data before the transformation is applied.
6884

6985
See [Azure Monitor pricing](https://azure.microsoft.com/pricing/details/monitor) for current charges for ingestion and retention of log data in Azure Monitor.
@@ -72,6 +88,221 @@ See [Azure Monitor pricing](https://azure.microsoft.com/pricing/details/monitor)
7288
> If Azure Sentinel is enabled for the Log Analytics workspace, then there is no filtering ingestion charge regardless of how much data the transformation filters.
7389
7490

91+
## Samples
92+
Following are Resource Manager templates of sample DCRs with different patterns. You can use these templates as a starting point to creating DCRs with transformations for your own scenarios.
93+
94+
### Single destination
95+
96+
The following example is a DCR for Azure Monitor agent that sends data to the `Syslog` table. In this example, the transformation filters the data for records with *error* in the message.
97+
98+
99+
```json
100+
{
101+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
102+
"contentVersion": "1.0.0.0",
103+
"resources" : [
104+
{
105+
"type": "Microsoft.Insights/dataCollectionRules",
106+
"name": "singleDestinationDCR",
107+
"apiVersion": "2021-09-01-preview",
108+
"location": "eastus",
109+
"properties": {
110+
"dataSources": {
111+
"syslog": [
112+
{
113+
"name": "sysLogsDataSource",
114+
"streams": [
115+
"Microsoft-Syslog"
116+
],
117+
"facilityNames": [
118+
"auth",
119+
"authpriv",
120+
"cron",
121+
"daemon",
122+
"mark",
123+
"kern",
124+
"mail",
125+
"news",
126+
"syslog",
127+
"user",
128+
"uucp"
129+
],
130+
"logLevels": [
131+
"Debug",
132+
"Critical",
133+
"Emergency"
134+
]
135+
}
136+
]
137+
},
138+
"destinations": {
139+
"logAnalytics": [
140+
{
141+
"workspaceResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace",
142+
"name": "centralWorkspace"
143+
}
144+
]
145+
},
146+
"dataFlows": [
147+
{
148+
"streams": [
149+
"Microsoft-Syslog"
150+
],
151+
"transformKql": "source | where message contains 'error'",
152+
"destinations": [
153+
"centralWorkspace"
154+
]
155+
}
156+
]
157+
}
158+
}
159+
]
160+
}
161+
```
162+
163+
### Multiple Azure tables
164+
165+
The following example is a DCR for data from Logs Ingestion API that sends data to both the `Syslog` and `SecurityEvent` table. This requires a separate `dataFlow` for each with a different `transformKql` and `OutputStream` for each. In this example, all incoming data is sent to the `Syslog` table while malicious data is also sent to the `SecurityEvent` table. If you didn't want to replicate the malicious data in both tables, you could add a `where` statement to first query to remove those records.
166+
167+
```json
168+
{
169+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
170+
"contentVersion": "1.0.0.0",
171+
"resources" : [
172+
{
173+
"type": "Microsoft.Insights/dataCollectionRules",
174+
"name": "multiDestinationDCR",
175+
"location": "eastus",
176+
"apiVersion": "2021-09-01-preview",
177+
"properties": {
178+
"dataCollectionEndpointId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-resource-group/providers//Microsoft.Insights/dataCollectionEndpoints/my-dce",
179+
"streamDeclarations": {
180+
"Custom-MyTableRawData": {
181+
"columns": [
182+
{
183+
"name": "Time",
184+
"type": "datetime"
185+
},
186+
{
187+
"name": "Computer",
188+
"type": "string"
189+
},
190+
{
191+
"name": "AdditionalContext",
192+
"type": "string"
193+
}
194+
]
195+
}
196+
},
197+
"destinations": {
198+
"logAnalytics": [
199+
{
200+
"workspaceResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace",
201+
"name": "clv2ws1"
202+
},
203+
]
204+
},
205+
"dataFlows": [
206+
{
207+
"streams": [
208+
"Custom-MyTableRawData"
209+
],
210+
"destinations": [
211+
"clv2ws1"
212+
],
213+
"transformKql": "source | project TimeGenerated = Time, Computer, Message = AdditionalContext",
214+
"outputStream": "Microsoft-Syslog"
215+
},
216+
{
217+
"streams": [
218+
"Custom-MyTableRawData"
219+
],
220+
"destinations": [
221+
"clv2ws1"
222+
],
223+
"transformKql": "source | where (AdditionalContext contains 'malicious traffic!' | project TimeGenerated = Time, Computer, Subject = AdditionalContext",
224+
"outputStream": "Microsoft-SecurityEvent"
225+
}
226+
]
227+
}
228+
}
229+
]
230+
}
231+
```
232+
233+
### Combination of Azure and custom tables
234+
235+
The following example is a DCR for data from Logs Ingestion API that sends data to both the `Syslog` table and a custom table with the data in a different format. This requires a separate `dataFlow` for each with a different `transformKql` and `OutputStream` for each.
236+
237+
238+
```json
239+
{
240+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
241+
"contentVersion": "1.0.0.0",
242+
"resources" : [
243+
{
244+
"type": "Microsoft.Insights/dataCollectionRules",
245+
"name": "multiDestinationDCR",
246+
"location": "eastus",
247+
"apiVersion": "2021-09-01-preview",
248+
"properties": {
249+
"dataCollectionEndpointId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-resource-group/providers//Microsoft.Insights/dataCollectionEndpoints/my-dce",
250+
"streamDeclarations": {
251+
"Custom-MyTableRawData": {
252+
"columns": [
253+
{
254+
"name": "Time",
255+
"type": "datetime"
256+
},
257+
{
258+
"name": "Computer",
259+
"type": "string"
260+
},
261+
{
262+
"name": "AdditionalContext",
263+
"type": "string"
264+
}
265+
]
266+
}
267+
},
268+
"destinations": {
269+
"logAnalytics": [
270+
{
271+
"workspaceResourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace",
272+
"name": "clv2ws1"
273+
},
274+
]
275+
},
276+
"dataFlows": [
277+
{
278+
"streams": [
279+
"Custom-MyTableRawData"
280+
],
281+
"destinations": [
282+
"clv2ws1"
283+
],
284+
"transformKql": "source | project TimeGenerated = Time, Computer, SyslogMessage = AdditionalContext",
285+
"outputStream": "Microsoft-Syslog"
286+
},
287+
{
288+
"streams": [
289+
"Custom-MyTableRawData"
290+
],
291+
"destinations": [
292+
"clv2ws1"
293+
],
294+
"transformKql": "source | extend jsonContext = parse_json(AdditionalContext) | project TimeGenerated = Time, Computer, AdditionalContext = jsonContext, ExtendedColumn=tostring(jsonContext.CounterName)",
295+
"outputStream": "Custom-MyTable_CL"
296+
}
297+
]
298+
}
299+
}
300+
]
301+
}
302+
```
303+
304+
305+
75306
## Next steps
76307

77308
- [Create a data collection rule](../agents/data-collection-rule-azure-monitor-agent.md) and an association to it from a virtual machine using the Azure Monitor agent.
15.8 KB
Loading

0 commit comments

Comments
 (0)