Limpa dados em um workspace do Log Analytics por um conjunto de filtros definidos pelo usuário.
Para gerenciar recursos do sistema, há um limite de 50 solicitações de limpeza por hora. Você deve executar em lote as solicitações de limpeza enviando um único comando cujo predicado inclui todas as identidades de usuário que exigem limpeza. Use o operador in para especificar várias identidades. Você deve executar a consulta antes de usar para uma solicitação de limpeza para verificar se os resultados são esperados.
O Log Analytics só dá suporte a operações de limpeza necessárias para conformidade com o GDPR. A equipe de produtos do Log Analytics reserva-se o direito de rejeitar solicitações para operações de limpeza que não são para fins de conformidade com GDPR. No caso de uma disputa, crie um tíquete de suporte
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/purge?api-version=2020-08-01
Parâmetros de URI
Nome |
Em |
Obrigatório |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos. O nome diferencia maiúsculas de minúsculas.
|
subscriptionId
|
path |
True
|
string
|
A ID da assinatura de destino.
|
workspaceName
|
path |
True
|
string
|
O nome do workspace.
Regex pattern: ^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$
|
api-version
|
query |
True
|
string
|
A versão da API a ser usada para esta operação.
|
Corpo da solicitação
Nome |
Obrigatório |
Tipo |
Description |
filters
|
True
|
WorkspacePurgeBodyFilters[]
|
O conjunto de colunas e filtros (consultas) a serem executados sobre eles para limpar os dados resultantes.
|
table
|
True
|
string
|
Tabela da qual limpar dados.
|
Respostas
Nome |
Tipo |
Description |
202 Accepted
|
WorkspacePurgeResponse
|
Solicitação aceita para limpar um workspace do Log Analytics.
Headers
x-ms-status-location: string
|
Segurança
azure_auth
Fluxo do OAuth2 do Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nome |
Description |
user_impersonation
|
representar sua conta de usuário
|
Exemplos
WorkspacePurge
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/OIAutoRest5123/providers/Microsoft.OperationalInsights/workspaces/aztest5048/purge?api-version=2020-08-01
{
"table": "Heartbeat",
"filters": [
{
"column": "TimeGenerated",
"operator": ">",
"value": "2017-09-01T00:00:00"
}
]
}
import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBody;
import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBodyFilters;
import java.util.Arrays;
/** Samples for WorkspacePurge Purge. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurge.json
*/
/**
* Sample code: WorkspacePurge.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void workspacePurge(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.workspacePurges()
.purgeWithResponse(
"OIAutoRest5123",
"aztest5048",
new WorkspacePurgeBody()
.withTable("Heartbeat")
.withFilters(
Arrays
.asList(
new WorkspacePurgeBodyFilters()
.withColumn("TimeGenerated")
.withOperator(">")
.withValue("2017-09-01T00:00:00"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.loganalytics import LogAnalyticsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-loganalytics
# USAGE
python workspaces_purge.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = LogAnalyticsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-00000000000",
)
response = client.workspace_purge.purge(
resource_group_name="OIAutoRest5123",
workspace_name="aztest5048",
body={
"filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}],
"table": "Heartbeat",
},
)
print(response)
# x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurge.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armoperationalinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurge.json
func ExampleWorkspacePurgeClient_Purge() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoperationalinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewWorkspacePurgeClient().Purge(ctx, "OIAutoRest5123", "aztest5048", armoperationalinsights.WorkspacePurgeBody{
Filters: []*armoperationalinsights.WorkspacePurgeBodyFilters{
{
Column: to.Ptr("TimeGenerated"),
Operator: to.Ptr(">"),
Value: "2017-09-01T00:00:00",
}},
Table: to.Ptr("Heartbeat"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Purges data in an Log Analytics workspace by a set of user-defined filters.
In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.
Log Analytics only supports purge operations required for compliance with GDPR. The Log Analytics product team reserves the right to reject requests for purge operations that are not for the purpose of GDPR compliance. In the event of a dispute, please create a support ticket
*
* @summary Purges data in an Log Analytics workspace by a set of user-defined filters.
In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.
Log Analytics only supports purge operations required for compliance with GDPR. The Log Analytics product team reserves the right to reject requests for purge operations that are not for the purpose of GDPR compliance. In the event of a dispute, please create a support ticket
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurge.json
*/
async function workspacePurge() {
const subscriptionId =
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-00000000000";
const resourceGroupName = process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "OIAutoRest5123";
const workspaceName = "aztest5048";
const body = {
filters: [{ column: "TimeGenerated", operator: ">", value: "2017-09-01T00:00:00" }],
table: "Heartbeat",
};
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.workspacePurge.purge(resourceGroupName, workspaceName, body);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.OperationalInsights;
using Azure.ResourceManager.OperationalInsights.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurge.json
// this example is just showing the usage of "WorkspacePurge_Purge" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this OperationalInsightsWorkspaceResource created on azure
// for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource
string subscriptionId = "00000000-0000-0000-0000-00000000000";
string resourceGroupName = "OIAutoRest5123";
string workspaceName = "aztest5048";
ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName);
OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId);
// invoke the operation
OperationalInsightsWorkspacePurgeContent content = new OperationalInsightsWorkspacePurgeContent("Heartbeat", new OperationalInsightsWorkspacePurgeFilter[]
{
new OperationalInsightsWorkspacePurgeFilter()
{
Column = "TimeGenerated",
Operator = ">",
Value = BinaryData.FromString("\"2017-09-01T00:00:00\""),
}
});
OperationalInsightsWorkspacePurgeResult result = await operationalInsightsWorkspace.PurgeAsync(content);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
x-ms-status-location: https://management.azure.com/subscriptions/b96161de-b34a-480f-7343-59b099299283/resourceGroups/example/providers/microsoft.operationalinsights/workspaces/test/operations/purge-970318e7-b859-4edb-8903-83b1b54d0b74?api-version=2020-08-01
{
"operationId": "7d7cf277-9113-4ab3-8359-d0364b74d01d"
}
WorkspacePurgeResourceId
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/OIAutoRest5123/providers/Microsoft.OperationalInsights/workspaces/aztest5048/purge?api-version=2020-08-01
{
"table": "Heartbeat",
"filters": [
{
"column": "_ResourceId",
"operator": "==",
"value": "/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/SomeResourceGroup/providers/microsoft.insights/components/AppInsightResource"
}
]
}
import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBody;
import com.azure.resourcemanager.loganalytics.models.WorkspacePurgeBodyFilters;
import java.util.Arrays;
/** Samples for WorkspacePurge Purge. */
public final class Main {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurgeResourceId.json
*/
/**
* Sample code: WorkspacePurgeResourceId.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void workspacePurgeResourceId(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.workspacePurges()
.purgeWithResponse(
"OIAutoRest5123",
"aztest5048",
new WorkspacePurgeBody()
.withTable("Heartbeat")
.withFilters(
Arrays
.asList(
new WorkspacePurgeBodyFilters()
.withColumn("_ResourceId")
.withOperator("==")
.withValue(
"/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/SomeResourceGroup/providers/microsoft.insights/components/AppInsightResource"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.loganalytics import LogAnalyticsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-loganalytics
# USAGE
python workspaces_purge_resource_id.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = LogAnalyticsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-00000000000",
)
response = client.workspace_purge.purge(
resource_group_name="OIAutoRest5123",
workspace_name="aztest5048",
body={
"filters": [
{
"column": "_ResourceId",
"operator": "==",
"value": "/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/SomeResourceGroup/providers/microsoft.insights/components/AppInsightResource",
}
],
"table": "Heartbeat",
},
)
print(response)
# x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurgeResourceId.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OperationalInsightsManagementClient } = require("@azure/arm-operationalinsights");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Purges data in an Log Analytics workspace by a set of user-defined filters.
In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.
Log Analytics only supports purge operations required for compliance with GDPR. The Log Analytics product team reserves the right to reject requests for purge operations that are not for the purpose of GDPR compliance. In the event of a dispute, please create a support ticket
*
* @summary Purges data in an Log Analytics workspace by a set of user-defined filters.
In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.
Log Analytics only supports purge operations required for compliance with GDPR. The Log Analytics product team reserves the right to reject requests for purge operations that are not for the purpose of GDPR compliance. In the event of a dispute, please create a support ticket
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurgeResourceId.json
*/
async function workspacePurgeResourceId() {
const subscriptionId =
process.env["OPERATIONALINSIGHTS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-00000000000";
const resourceGroupName = process.env["OPERATIONALINSIGHTS_RESOURCE_GROUP"] || "OIAutoRest5123";
const workspaceName = "aztest5048";
const body = {
filters: [
{
column: "_ResourceId",
operator: "==",
value:
"/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/SomeResourceGroup/providers/microsoft.insights/components/AppInsightResource",
},
],
table: "Heartbeat",
};
const credential = new DefaultAzureCredential();
const client = new OperationalInsightsManagementClient(credential, subscriptionId);
const result = await client.workspacePurge.purge(resourceGroupName, workspaceName, body);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.OperationalInsights;
using Azure.ResourceManager.OperationalInsights.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2020-08-01/examples/WorkspacesPurgeResourceId.json
// this example is just showing the usage of "WorkspacePurge_Purge" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this OperationalInsightsWorkspaceResource created on azure
// for more information of creating OperationalInsightsWorkspaceResource, please refer to the document of OperationalInsightsWorkspaceResource
string subscriptionId = "00000000-0000-0000-0000-00000000000";
string resourceGroupName = "OIAutoRest5123";
string workspaceName = "aztest5048";
ResourceIdentifier operationalInsightsWorkspaceResourceId = OperationalInsightsWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName);
OperationalInsightsWorkspaceResource operationalInsightsWorkspace = client.GetOperationalInsightsWorkspaceResource(operationalInsightsWorkspaceResourceId);
// invoke the operation
OperationalInsightsWorkspacePurgeContent content = new OperationalInsightsWorkspacePurgeContent("Heartbeat", new OperationalInsightsWorkspacePurgeFilter[]
{
new OperationalInsightsWorkspacePurgeFilter()
{
Column = "_ResourceId",
Operator = "==",
Value = BinaryData.FromString("\"/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/SomeResourceGroup/providers/microsoft.insights/components/AppInsightResource\""),
}
});
OperationalInsightsWorkspacePurgeResult result = await operationalInsightsWorkspace.PurgeAsync(content);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
x-ms-status-location: https://management.azure.com/subscriptions/b96161de-b34a-480f-7343-59b099299283/resourceGroups/example/providers/microsoft.operationalinsights/workspaces/test/operations/purge-970318e7-b859-4edb-8903-83b1b54d0b74?api-version=2020-08-01
{
"operationId": "7d7cf277-9113-4ab3-8359-d0364b74d01d"
}
Definições
WorkspacePurgeBody
Descreve o corpo de uma solicitação de limpeza para um workspace do App Insights
Nome |
Tipo |
Description |
filters
|
WorkspacePurgeBodyFilters[]
|
O conjunto de colunas e filtros (consultas) a serem executados sobre eles para limpar os dados resultantes.
|
table
|
string
|
Tabela da qual limpar dados.
|
WorkspacePurgeBodyFilters
Filtros definidos pelo usuário para retornar dados que serão limpos da tabela.
Nome |
Tipo |
Description |
column
|
string
|
A coluna da tabela sobre a qual a consulta determinada deve ser executada
|
key
|
string
|
Ao filtrar por dimensões personalizadas, essa chave será usada como o nome da dimensão personalizada.
|
operator
|
string
|
Um operador de consulta a ser avaliado sobre a coluna e os valores fornecidos. Os operadores com suporte são ==, =~, in, in~, >, >=, <, <=, between e têm o mesmo comportamento que em uma consulta KQL.
|
value
|
|
o valor do operador sobre o qual o operador funcionará. Isso pode ser um número (por exemplo, > 100), uma cadeia de caracteres (carimbo de data/hora >= '2017-09-01') ou uma matriz de valores.
|
WorkspacePurgeResponse
Resposta que contém operationId para uma ação de limpeza específica.
Nome |
Tipo |
Description |
operationId
|
string
|
ID a ser usada ao consultar status para uma operação de limpeza específica.
|