Skip to content

Commit 349980d

Browse files
authored
Merge pull request #216868 from guywi-ms/manage-tables-new-toc
Log table management
2 parents 66aae64 + c4f18b7 commit 349980d

20 files changed

+342
-102
lines changed

articles/azure-monitor/agents/data-sources-custom-logs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,25 @@ The following section walks through an example of creating a custom log. The sam
147147

148148
We provide one of the log files and can see the events that it will be collecting. In this case, **New line** is a sufficient delimiter. If a single entry in the log could span multiple lines though, a timestamp delimiter would need to be used.
149149

150-
![Screenshot that shows uploading and parsing a sample log.](media/data-sources-custom-logs/delimiter.png)
150+
:::image type="content" source="media/data-sources-custom-logs/delimiter.png" alt-text="Screenshot that shows uploading and parsing a sample log.":::
151151

152152
### Add log collection paths
153153

154154
The log files will be located in *C:\MyApp\Logs*. A new file will be created each day with a name that includes the date in the pattern *appYYYYMMDD.log*. A sufficient pattern for this log would be *C:\MyApp\Logs\\\*.log*.
155155

156-
![Screenshot that shows adding a log collection path.](media/data-sources-custom-logs/collection-path.png)
156+
:::image type="content" source="media/data-sources-custom-logs/collection-path.png" alt-text="Screenshot that shows adding a log collection path.":::
157157

158158
### Provide a name and description for the log
159159

160160
We use a name of *MyApp_CL* and type in a **Description**.
161161

162-
![Screenshot that shows adding a log name.](media/data-sources-custom-logs/log-name.png)
162+
:::image type="content" source="media/data-sources-custom-logs/log-name.png" alt-text="Screenshot that shows adding a log name.":::
163163

164164
### Validate that the custom logs are being collected
165165

166166
We use a simple query of *MyApp_CL* to return all records from the collected log.
167167

168-
![Screenshot that shows a log query with no custom fields.](media/data-sources-custom-logs/query-01.png)
168+
:::image type="content" source="media/data-sources-custom-logs/query-01.png" alt-text="Screenshot that shows a log query with no custom fields.":::
169169

170170
## Alternatives to custom logs
171171

-3.56 KB
Loading
-4.95 KB
Loading
-7 Bytes
Loading

articles/azure-monitor/logs/basic-logs-configure.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
11
---
2-
title: Configure Basic Logs in Azure Monitor
3-
description: Learn how to configure a table for Basic Logs in Azure Monitor.
4-
ms.topic: conceptual
5-
ms.custom: event-tier1-build-2022
6-
ms.date: 10/01/2022
2+
title: Set a table's log data plan in Azure Monitor Logs
3+
description: Learn how to configure the table log data plan to optimize log ingestion and retention costs in Azure Monitor Logs.
4+
author: guywi-ms
5+
ms.author: guywild
6+
ms.reviewer: adi.biran
7+
ms.topic: how-to
8+
ms.date: 11/09/2022
79
---
810

9-
# Configure Basic Logs in Azure Monitor
11+
# Set a table's log data plan in Azure Monitor Logs
1012

11-
Setting a table's [log data plan](log-analytics-workspace-overview.md#log-data-plans) to **Basic Logs** lets you save on the cost of storing high-volume verbose logs you use for debugging, troubleshooting, and auditing, but not for analytics and alerts. This article describes how to configure Basic Logs for a particular table in your Log Analytics workspace.
13+
Azure Monitor Logs offers two log data plans that let you reduce log ingestion and retention costs and take advantage of Azure Monitor's advanced features and analytics capabilities based on your needs:
14+
15+
- The default **Analytics** log data plan provides full analysis capabilities and makes log data available for queries, Azure Monitor features, such as alerts, and use by other services.
16+
- The **Basic** log data plan lets you save on the cost of ingesting and storing high-volume verbose logs in your Log Analytics workspace for debugging, troubleshooting, and auditing, but not for analytics and alerts.
17+
18+
This article describes Azure Monitor's log data plans and explains how to configure the log data plan of the tables in your Log Analytics workspace.
1219

1320
> [!IMPORTANT]
14-
> You can switch a table's plan once a week. The Basic Logs feature isn't available for workspaces in [legacy pricing tiers](cost-logs.md#legacy-pricing-tiers).
21+
> You can switch a table's plan once a week.<br/> The Basic Logs feature isn't available for workspaces in [legacy pricing tiers](cost-logs.md#legacy-pricing-tiers).
22+
23+
## Compare the Basic and Analytics log data plans
24+
25+
The following table summarizes the two plans.
26+
27+
| Category | Analytics | Basic |
28+
|:---|:---|:---|
29+
| Ingestion | Cost for ingestion. | Reduced cost for ingestion. |
30+
| Log queries | No extra cost. Full query capabilities. | Extra cost.<br>[Subset of query capabilities](basic-logs-query.md#limitations). |
31+
| Retention | Configure retention from 30 days to 730 days. | Retention fixed at eight days. |
32+
| Alerts | Supported. | Not supported. |
33+
34+
> [!NOTE]
35+
> The Basic log data plan isn't available for workspaces in [legacy pricing tiers](cost-logs.md#legacy-pricing-tiers).
1536
1637
## Which tables support Basic Logs?
1738

@@ -31,7 +52,7 @@ By default, all tables in your Log Analytics workspace are Analytics tables, and
3152
> [!NOTE]
3253
> Tables created with the [Data Collector API](data-collector-api.md) don't support Basic Logs.
3354
34-
## Set table configuration
55+
## Set a table's log data plan
3556

3657
# [Portal](#tab/portal-1)
3758

@@ -143,11 +164,11 @@ For example:
143164
144165
---
145166
146-
## Check table configuration
167+
## View a table's log data plan
147168
148169
# [Portal](#tab/portal-2)
149170
150-
To check table configuration in the Azure portal, you can open the table configuration screen, as described in [Set table configuration](#set-table-configuration).
171+
To check table configuration in the Azure portal, you can open the table configuration screen, as described in [Set table configuration](#set-a-tables-log-data-plan).
151172
152173
Alternatively:
153174
@@ -175,7 +196,7 @@ GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{
175196
|Name | Type | Description |
176197
| --- | --- | --- |
177198
|properties.plan | string | The table plan. Either `Analytics` or `Basic`. |
178-
|properties.retentionInDays | integer | The table's data retention in days. In `Basic Logs`, the value is 8 days, fixed. In `Analytics Logs`, the value is between 7 and 730 days.|
199+
|properties.retentionInDays | integer | The table's data retention in days. In `Basic Logs`, the value is eight days, fixed. In `Analytics Logs`, the value is between 7 and 730 days.|
179200
|properties.totalRetentionInDays | integer | The table's data retention that also includes the archive period.|
180201
|properties.archiveRetentionInDays|integer|The table's archive period (read-only, calculated).|
181202
|properties.lastPlanModifiedDate|String|Last time when the plan was set for this table. Null if no change was ever done from the default settings (read-only).
@@ -225,5 +246,6 @@ Basic Logs tables retain data for eight days. When you change an existing table'
225246

226247
## Next steps
227248

228-
- [Learn more about the different log plans](log-analytics-workspace-overview.md#log-data-plans)
229249
- [Query data in Basic Logs](basic-logs-query.md)
250+
- [Set retention and archive policies](../logs/data-retention-archive.md)
251+

articles/azure-monitor/logs/basic-logs-query.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: Query data from Basic Logs in Azure Monitor
33
description: Create a log query using tables configured for Basic logs in Azure Monitor.
4+
author: guywi-ms
5+
ms.author: guywild
6+
ms.reviewer: adi.biran
47
ms.topic: conceptual
58
ms.date: 10/01/2022
69

@@ -9,7 +12,7 @@ ms.date: 10/01/2022
912
# Query Basic Logs in Azure Monitor
1013
Basic Logs tables reduce the cost of ingesting high-volume verbose logs and let you query the data they store using a limited set of log queries. This article explains how to query data from Basic Logs tables.
1114

12-
For more information, see [Azure log data plans](log-analytics-workspace-overview.md#log-data-plans) and [Configure a table for Basic Logs](basic-logs-configure.md).
15+
For more information, see [Set a table's log data plan](basic-logs-configure.md).
1316

1417

1518
> [!NOTE]
@@ -95,6 +98,5 @@ For more information, see [Azure Monitor pricing](https://azure.microsoft.com/pr
9598
9699
## Next steps
97100

98-
- [Learn more about Basic Logs and the different log plans.](log-analytics-workspace-overview.md#log-data-plans)
99-
- [Configure a table for Basic Logs.](basic-logs-configure.md)
100-
- [Use a search job to retrieve data from Basic Logs into Analytics Logs where it can be queries multiple times.](search-jobs.md)
101+
- [Learn more about the Basic Logs and Analytics log plans](basic-logs-configure.md).
102+
- [Use a search job to retrieve data from Basic Logs into Analytics Logs where it can be queries multiple times](search-jobs.md).
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
title: Add or delete tables and columns in Azure Monitor Logs
3+
description: Create a table with a custom schema to collect logs from any data source.
4+
author: guywi-ms
5+
ms.author: guywild
6+
ms.reviewer: adi.biran
7+
ms.service: azure-monitor
8+
ms.topic: how-to
9+
ms.date: 11/09/2022
10+
11+
# Customer intent: As a Log Analytics workspace administrator, I want to create a table with a custom schema to store logs from an Azure or non-Azure data source.
12+
---
13+
14+
# Add or delete tables and columns in Azure Monitor Logs
15+
16+
[Data collection rules](../essentials/data-collection-rule-overview.md) let you [filter and transform log data](../essentials/data-collection-transformations.md) before sending the data to an [Azure table or a custom table](../logs/manage-logs-tables.md#table-type). This article explains how to create custom tables and add custom columns to tables in your Log Analytics workspace.
17+
18+
## Prerequisites
19+
20+
To create a custom table, you need:
21+
22+
- A Log Analytics workspace where you have at least [contributor rights](../logs/manage-access.md#azure-rbac).
23+
- A [data collection endpoint (DCE)](../essentials/data-collection-endpoint-overview.md).
24+
- A JSON file with the schema of your custom table in the following format:
25+
```json
26+
[
27+
{
28+
"TimeGenerated": "supported_datetime_format",
29+
"<column_name_1": "<column_name_1_value>",
30+
"<column_name_2": "<column_name_2_value>"
31+
}
32+
]
33+
```
34+
35+
For information about the `TimeGenerated` format, see [supported datetime formats](/azure/data-explorer/kusto/query/scalar-data-types/datetime#supported-formats).
36+
## Create a custom table
37+
38+
Azure tables have predefined schemas. To store log data in a different schema, use data collection rules to define how to collect, transform, and send the data to a custom table in your Log Analytics workspace.
39+
40+
> [!NOTE]
41+
> For information about creating a custom table for logs you ingest with the deprecated Log Analytics agent, also known as MMA or OMS, see [Collect text logs with the Log Analytics agent](../agents/data-sources-custom-logs.md#define-a-custom-log).
42+
43+
### [Portal](#tab/portal-1)
44+
45+
To create a custom table in the Azure portal:
46+
47+
1. From the **Log Analytics workspaces** menu, select **Tables**.
48+
49+
:::image type="content" source="media/manage-logs-tables/azure-monitor-logs-table-configuration.png" alt-text="Screenshot that shows the Tables screen for a Log Analytics workspace." lightbox="media/manage-logs-tables/azure-monitor-logs-table-configuration.png":::
50+
51+
1. Select **Create** and then **New custom log (DCR-based)**.
52+
53+
:::image type="content" source="media/tutorial-logs-ingestion-portal/new-custom-log.png" lightbox="media/tutorial-logs-ingestion-portal/new-custom-log.png" alt-text="Screenshot showing new DCR-based custom log.":::
54+
55+
1. Specify a name and, optionally, a description for the table. You don't need to add the *_CL* suffix to the custom table's name - this is added automatically to the name you specify in the portal.
56+
57+
1. Select an existing data collection rule from the **Data collection rule** dropdown, or select **Create a new data collection rule** and specify the **Subscription**, **Resource group**, and **Name** for the new data collection rule.
58+
59+
:::image type="content" source="media/tutorial-logs-ingestion-portal/new-data-collection-rule.png" lightbox="media/tutorial-logs-ingestion-portal/new-data-collection-rule.png" alt-text="Screenshot showing new data collection rule.":::
60+
61+
4. Select a [data collection endpoint](../essentials/data-collection-endpoint-overview.md#create-data-collection-endpoint) and select **Next**.
62+
63+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-table-name.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-table-name.png" alt-text="Screenshot showing custom log table name.":::
64+
65+
1. Select **Browse for files** and locate the JSON file in which you defined the schema of your new table.
66+
67+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-browse-files.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-browse-files.png" alt-text="Screenshot showing custom log browse for files.":::
68+
69+
All log tables in Azure Monitor Logs must have a `TimeGenerated` column populated with the timestamp of the logged event.
70+
71+
1. If you want to [transform log data before ingestion](../essentials//data-collection-transformations.md) into your table:
72+
73+
1. Select **Transformation editor**.
74+
75+
The transformation editor lets you create a transformation for the incoming data stream. This is a KQL query that runs against each incoming record. Azure Monitor Logs stores the results of the query in the destination table.
76+
77+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-data-preview.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-data-preview.png" alt-text="Screenshot showing custom log data preview.":::
78+
79+
1. Select **Run** to view the results.
80+
81+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-query-01.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-query-01.png" alt-text="Screenshot showing initial custom log data query.":::
82+
83+
1. Select **Apply** to save the transformation and view the schema of the table that's about to be created. Select **Next** to proceed.
84+
85+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-final-schema.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-final-schema.png" alt-text="Screenshot showing custom log final schema.":::
86+
87+
1. Verify the final details and select **Create** to save the custom log.
88+
89+
:::image type="content" source="media/tutorial-logs-ingestion-portal/custom-log-create.png" lightbox="media/tutorial-logs-ingestion-portal/custom-log-create.png" alt-text="Screenshot showing custom log create.":::
90+
91+
### [PowerShell](#tab/powershell-1)
92+
93+
Use the [Tables - Update PATCH API](/rest/api/loganalytics/tables/update) to create a custom 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.
94+
95+
> [!IMPORTANT]
96+
> Custom tables have a suffix of *_CL*; for example, *tablename_CL*. The *tablename_CL* in the DataFlows Streams must match the *tablename_CL* name in the Log Analytics workspace.
97+
98+
1. Select the **Cloud Shell** button in the Azure portal and ensure the environment is set to **PowerShell**.
99+
100+
:::image type="content" source="../logs/media/tutorial-workspace-transformations-api/open-cloud-shell.png" lightbox="../logs/media/tutorial-workspace-transformations-api/open-cloud-shell.png" alt-text="Screenshot of opening Cloud Shell in the Azure portal.":::
101+
102+
2. Copy the following PowerShell code and replace the **Path** parameter with the appropriate values for your workspace in the `Invoke-AzRestMethod` command. Paste it into the Cloud Shell prompt to run it.
103+
104+
```PowerShell
105+
$tableParams = @'
106+
{
107+
"properties": {
108+
"schema": {
109+
"name": "MyTable_CL",
110+
"columns": [
111+
{
112+
"name": "TimeGenerated",
113+
"type": "DateTime"
114+
},
115+
{
116+
"name": "RawData",
117+
"type": "String"
118+
}
119+
]
120+
}
121+
}
122+
}
123+
'@
124+
125+
Invoke-AzRestMethod -Path "/subscriptions/{subscription}/resourcegroups/{resourcegroup}/providers/microsoft.operationalinsights/workspaces/{workspace}/tables/MyTable_CL?api-version=2021-12-01-preview" -Method PUT -payload $tableParams
126+
```
127+
128+
---
129+
130+
## Delete a table
131+
132+
You can delete any table in your Log Analytics workspace that's not an [Azure table](../logs/manage-logs-tables.md#table-type).
133+
134+
> [!NOTE]
135+
> Deleting a restored table doesn't delete the data in the source table.
136+
137+
### [Portal](#tab/portal-2)
138+
139+
To delete a table from the Azure portal:
140+
141+
1. From the Log Analytics workspace menu, select **Tables**.
142+
1. Search for the tables you want to delete by name, or by selecting **Search results** in the **Type** field.
143+
144+
:::image type="content" source="media/search-job/search-results-on-log-analytics-tables-screen.png" alt-text="Screenshot that shows the Tables screen for a Log Analytics workspace with the Filter by name and Type fields highlighted." lightbox="media/search-job/search-results-on-log-analytics-tables-screen.png":::
145+
146+
1. Select the table you want to delete, select the ellipsis ( **...** ) to the right of the table, select **Delete**, and confirm the deletion by typing **yes**.
147+
148+
:::image type="content" source="media/search-job/delete-table.png" alt-text="Screenshot that shows the Delete Table screen for a table in a Log Analytics workspace." lightbox="media/search-job/delete-table.png":::
149+
150+
### [API](#tab/api-2)
151+
152+
To delete a table, call the **Tables - Delete** API:
153+
154+
```http
155+
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/<TableName>_SRCH?api-version=2021-12-01-preview
156+
```
157+
158+
### [CLI](#tab/cli-2)
159+
160+
To delete a table, run the [az monitor log-analytics workspace table delete](/cli/azure/monitor/log-analytics/workspace/table#az-monitor-log-analytics-workspace-table-delete) command.
161+
162+
For example:
163+
164+
```azurecli
165+
az monitor log-analytics workspace table delete --subscription ContosoSID --resource-group ContosoRG --workspace-name ContosoWorkspace --name HeartbeatByIp_SRCH
166+
```
167+
168+
---
169+
## Add or delete a custom column
170+
171+
To add a custom column to a table in your Log Analytics workspace, or delete a column:
172+
173+
1. From the **Log Analytics workspaces** menu, select **Tables**.
174+
1. Select the ellipsis ( **...** ) to the right of the table you want to edit and select **Edit schema**.
175+
This opens the **Schema Editor** screen.
176+
1. Scroll down to the **Custom Columns** section of the **Schema Editor** screen.
177+
178+
:::image type="content" source="media/create-custom-table/add-or-delete-column-azure-monitor-logs.png" alt-text="Screenshot showing the Schema Editor screen with the Add a column and Delete buttons highlighted." lightbox="media/create-custom-table/add-or-delete-column-azure-monitor-logs.png":::
179+
180+
1. To add a new column:
181+
1. Select **Add a column**.
182+
1. Set the column name and description (optional), and select the expected value type from the **Type** dropdown.
183+
1. Select **Save** to save the new column.
184+
1. To delete a column, select the **Delete** icon to the left of the column you want to delete.
185+
186+
## Next steps
187+
188+
Learn more about:
189+
190+
- [Collecting logs with the Log Ingestion API](../logs/logs-ingestion-api-overview.md)
191+
- [Collecting logs with Azure Monitor Agent](../agents/agents-overview.md)
192+
- [Data collection rules](../essentials/data-collection-endpoint-overview.md)

articles/azure-monitor/logs/data-retention-archive.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Configure data retention and archive in Azure Monitor Logs (preview)
2+
title: Configure data retention and archive in Azure Monitor Logs
33
description: Configure archive settings for a table in a Log Analytics workspace in Azure Monitor.
4-
ms.reviewer: osalzberg
4+
ms.reviewer: adi.biran
55
ms.topic: conceptual
66
ms.date: 10/01/2022
77
# Customer intent: As an Azure account administrator, I want to set data retention and archive policies to save retention costs.
@@ -241,4 +241,4 @@ The retention can also be [set programmatically with PowerShell](../app/powershe
241241

242242
- [Learn more about Log Analytics workspaces and data retention and archive](log-analytics-workspace-overview.md)
243243
- [Create a search job to retrieve archive data matching particular criteria](search-jobs.md)
244-
- [Restore archive data within a particular time range](restore.md)
244+
- [Restore archive data within a particular time range](restore.md)

0 commit comments

Comments
 (0)