Skip to content

Commit 0a22e1f

Browse files
Merge pull request #283276 from kainawroth/kainawroth-logs
Adding PowerShell example with table name
2 parents 628b3c9 + d0c6134 commit 0a22e1f

File tree

1 file changed

+69
-54
lines changed

1 file changed

+69
-54
lines changed

articles/azure-monitor/logs/logs-table-plans.md

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ ms.date: 07/04/2024
1414

1515
You can use one Log Analytics workspace to store any type of log required for any purpose. For example:
1616

17-
- High-volume, verbose data that requires **cheap long-term storage for audit and compliance**
18-
- App and resource data for **troubleshooting** by developers
19-
- Key event and performance data for scaling and alerting to ensure ongoing **operational excellence and security**
20-
- Aggregated long-term data trends for **advanced analytics and machine learning**
17+
* High-volume, verbose data that requires **cheap long-term storage for audit and compliance**
18+
* App and resource data for **troubleshooting** by developers
19+
* Key event and performance data for scaling and alerting to ensure ongoing **operational excellence and security**
20+
* Aggregated long-term data trends for **advanced analytics and machine learning**
2121

2222
Table plans let you manage data costs based on how often you use the data in a table and the type of analysis you need the data for. This article explains and how to set a table's plan.
2323

@@ -39,8 +39,9 @@ All tables support the Analytics plan and all DCR-based custom tables and [some
3939
When you change a table's plan from Analytics to Basic, Azure monitor treats any data that's older than 30 days as long-term retention data based on the total retention period set for the table. In other words, the total retention period of the table remains unchanged, unless you explicitly [modify the long-term retention period](../logs/data-retention-configure.md).
4040

4141
> [!NOTE]
42-
> You can switch a table's plan once a week.
43-
# [Portal](#tab/portal-1)
42+
> You can switch a table's plan once a week.
43+
44+
### [Portal](#tab/portal-1)
4445

4546
Analytics is the default table plan of all tables you create in the portal. You can switch between the Analytics and Basic plans, as described in this section.
4647

@@ -62,24 +63,24 @@ To switch a table's plan in the Azure portal:
6263

6364
1. Select **Save**.
6465

65-
# [API](#tab/api-1)
66+
### [API](#tab/api-1)
6667

6768
To configure a table for Basic logs or Analytics logs, call the [Tables - Update API](/rest/api/loganalytics/tables/create-or-update):
6869

6970
```http
7071
PATCH https://management.azure.com/subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/Microsoft.OperationalInsights/workspaces/<workspaceName>/tables/<tableName>?api-version=2021-12-01-preview
7172
```
7273

73-
> [!IMPORTANT]
74-
> Use the bearer token for authentication. Learn more about [using bearer tokens](https://social.technet.microsoft.com/wiki/contents/articles/51140.azure-rest-management-api-the-quickest-way-to-get-your-bearer-token.aspx).
75-
7674
**Request body**
7775

78-
|Name | Type | Description |
79-
| --- | --- | --- |
80-
|properties.plan | string | The table plan. Possible values are `Analytics` and `Basic`.|
76+
| Name | Type | Description |
77+
|-----------------|--------|--------------------------------------------------------------|
78+
| properties.plan | string | The table plan. Possible values are `Analytics` and `Basic`. |
79+
80+
> [!IMPORTANT]
81+
> Use the bearer token for authentication. Learn more about [using bearer tokens](https://social.technet.microsoft.com/wiki/contents/articles/51140.azure-rest-management-api-the-quickest-way-to-get-your-bearer-token.aspx).
8182
82-
**Example**
83+
#### Example
8384

8485
This example configures the `ContainerLogV2` table for Basic logs.
8586

@@ -91,77 +92,91 @@ Container Insights uses `ContainerLog` by default. To switch to using `Container
9192
PATCH https://management.azure.com/subscriptions/ContosoSID/resourcegroups/ContosoRG/providers/Microsoft.OperationalInsights/workspaces/ContosoWorkspace/tables/ContainerLogV2?api-version=2021-12-01-preview
9293
```
9394

94-
Use this request body to change to Basic logs:
95+
* Use this request body to change to Basic logs:
9596

96-
```http
97-
{
98-
"properties": {
99-
"plan": "Basic"
97+
```http
98+
{
99+
"properties": {
100+
"plan": "Basic"
101+
}
100102
}
101-
}
102-
```
103+
```
103104
104-
Use this request body to change to Analytics Logs:
105+
* Use this request body to change to Analytics Logs:
105106
106-
```http
107-
{
108-
"properties": {
109-
"plan": "Analytics"
107+
```http
108+
{
109+
"properties": {
110+
"plan": "Analytics"
111+
}
110112
}
111-
}
112-
```
113+
```
113114
114115
**Sample response**
115116
116-
This sample is the response for a table changed to Basic logs:
117-
118-
Status code: 200
119-
120-
```http
121-
{
122-
"properties": {
123-
"retentionInDays": 30,
124-
"totalRetentionInDays": 30,
125-
"archiveRetentionInDays": 22,
126-
"plan": "Basic",
127-
"lastPlanModifiedDate": "2022-01-01T14:34:04.37",
128-
"schema": {...}
129-
},
130-
"id": "subscriptions/ContosoSID/resourcegroups/ContosoRG/providers/Microsoft.OperationalInsights/workspaces/ContosoWorkspace",
131-
"name": "ContainerLogV2"
132-
}
133-
```
117+
* This sample is the response for a table changed to Basic logs:
118+
119+
Status code: 200
120+
121+
```http
122+
{
123+
"properties": {
124+
"retentionInDays": 30,
125+
"totalRetentionInDays": 30,
126+
"archiveRetentionInDays": 22,
127+
"plan": "Basic",
128+
"lastPlanModifiedDate": "2022-01-01T14:34:04.37",
129+
"schema": {...}
130+
},
131+
"id": "subscriptions/ContosoSID/resourcegroups/ContosoRG/providers/Microsoft.OperationalInsights/workspaces/ContosoWorkspace",
132+
"name": "ContainerLogV2"
133+
}
134+
```
134135
135-
# [CLI](#tab/cli-1)
136+
### [CLI](#tab/cli-1)
136137
137138
To configure a table for Basic logs or Analytics logs, run the [az monitor log-analytics workspace table update](/cli/azure/monitor/log-analytics/workspace/table#az-monitor-log-analytics-workspace-table-update) command and set the `--plan` parameter to `Basic` or `Analytics`.
138139
139-
For example:
140+
#### Examples
140141
141-
- To set Basic logs:
142+
* To set Basic logs:
142143
143144
```azurecli
144145
az monitor log-analytics workspace table update --subscription ContosoSID --resource-group ContosoRG --workspace-name ContosoWorkspace --name ContainerLogV2 --plan Basic
145146
```
146147
147-
- To set Analytics Logs:
148+
* To set Analytics Logs:
148149
149150
```azurecli
150151
az monitor log-analytics workspace table update --subscription ContosoSID --resource-group ContosoRG --workspace-name ContosoWorkspace --name ContainerLogV2 --plan Analytics
151152
```
152153
153-
# [PowerShell](#tab/azure-powershell)
154+
### [PowerShell](#tab/azure-powershell)
154155
155156
To configure a table's plan, use the [Update-AzOperationalInsightsTable](/powershell/module/az.operationalinsights/Update-AzOperationalInsightsTable) cmdlet:
156157
157158
```powershell
158-
Update-AzOperationalInsightsTable -ResourceGroupName RG-NAME -WorkspaceName WORKSPACE-NAME -Plan Basic|Analytics
159+
Update-AzOperationalInsightsTable -ResourceGroupName RG-NAME -WorkspaceName WORKSPACE-NAME -TableName TABLE-NAME -Plan Basic|Analytics
159160
```
160161

162+
#### Examples
163+
164+
* To set Basic logs:
165+
166+
```powershell
167+
Update-AzOperationalInsightsTable -ResourceGroupName ContosoRG -WorkspaceName ContosoWorkspace -TableName ContainerLogV2 -Plan Basic
168+
```
169+
170+
* To set Analytics Logs:
171+
172+
```powershell
173+
Update-AzOperationalInsightsTable -ResourceGroupName ContosoRG -WorkspaceName ContosoWorkspace -TableName ContainerLogV2 -Plan Analytics
174+
```
175+
161176
---
162177
163178
## Related content
164179
165-
- [Manage data retention](../logs/data-retention-configure.md).
166-
- [Tables that support the Basic table plan in Azure Monitor Logs](basic-logs-azure-tables.md).
180+
* [Manage data retention](../logs/data-retention-configure.md).
181+
* [Tables that support the Basic table plan in Azure Monitor Logs](basic-logs-azure-tables.md).
167182

0 commit comments

Comments
 (0)