Een webhook configureren om waarschuwingen voor activiteitenlogboeken op te halen
Als onderdeel van de definitie van een actiegroep kunt u webhookeindpunten configureren voor het ontvangen van waarschuwingsmeldingen voor activiteitenlogboeken. Met webhooks kunt u deze meldingen doorsturen naar andere systemen voor naverwerking of aangepaste acties. In dit artikel ziet u hoe de nettolading voor de HTTP POST naar een webhook eruitziet.
Zie voor meer informatie over waarschuwingen voor activiteitenlogboeken hoe u waarschuwingen voor Azure-activiteitenlogboeken maakt.
Zie hoe u actiegroepen maakt voor informatie over actiegroepen.
Notitie
U kunt ook het algemene waarschuwingsschema voor uw webhookintegraties gebruiken. Het biedt het voordeel van één uitbreidbare en uniforme nettolading van waarschuwingen voor alle waarschuwingsservices in Azure Monitor. Meer informatie over het algemene waarschuwingsschema.
De webhook verifiëren
De webhook kan eventueel verificatie op basis van tokens gebruiken. De webhook-URI wordt bijvoorbeeld opgeslagen met een token-id https://mysamplealert/webcallback?tokenid=sometokenid&someparameter=somevalue
.
Payloadschema
De JSON-nettolading in de POST-bewerking verschilt op basis van het veld van data.context.activityLog.eventSource
de nettolading.
Notitie
Op dit moment wordt de beschrijving die deel uitmaakt van de gebeurtenis in het activiteitenlogboek gekopieerd naar de geactiveerde Alert Description
eigenschap.
Als u de nettolading van het activiteitenlogboek wilt uitlijnen met andere waarschuwingstypen, bevat de eigenschap Description
geactiveerde waarschuwing vanaf 1 april 2021 de beschrijving van de waarschuwingsregel.
Ter voorbereiding op die wijziging hebben we een nieuwe eigenschap gemaakt, Activity Log Event Description
in het geactiveerde activiteitenlogboek. Deze nieuwe eigenschap wordt gevuld met de Description
eigenschap die al beschikbaar is voor gebruik. Het nieuwe veld Activity Log Event Description
bevat dus de beschrijving die deel uitmaakt van de gebeurtenis in het activiteitenlogboek.
Controleer uw waarschuwingsregels, actieregels, webhooks, logische app of andere configuraties waarbij u de eigenschap van de Description
geactiveerde waarschuwing mogelijk gebruikt. Vervang de Description
eigenschap door de Activity Log Event Description
eigenschap.
Als uw voorwaarde in uw actieregels, webhooks, logische app of andere configuraties momenteel is gebaseerd op de Description
eigenschap voor waarschuwingen voor activiteitenlogboeken, moet u deze mogelijk wijzigen op basis van de Activity Log Event Description
eigenschap.
Als u de nieuwe Description
eigenschap wilt vullen, kunt u een beschrijving toevoegen in de definitie van de waarschuwingsregel.
Gemeenschappelijk
{
"schemaId": "Microsoft.Insights/activityLogs",
"data": {
"status": "Activated",
"context": {
"activityLog": {
"channels": "Operation",
"correlationId": "aaaa0000-bb11-2222-33cc-444444dddddd",
"eventSource": "Administrative",
"eventTimestamp": "2017-03-29T15:43:08.0019532+00:00",
"eventDataId": "8195a56a-85de-4663-943e-1a2bf401ad94",
"level": "Informational",
"operationName": "Microsoft.Insights/actionGroups/write",
"operationId": "aaaa0000-bb11-2222-33cc-444444dddddd",
"status": "Started",
"subStatus": "",
"subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"submissionTimestamp": "2017-03-29T15:43:20.3863637+00:00",
...
}
},
"properties": {}
}
}
Beheer
{
"schemaId": "Microsoft.Insights/activityLogs",
"data": {
"status": "Activated",
"context": {
"activityLog": {
"authorization": {
"action": "Microsoft.Insights/actionGroups/write",
"scope": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/IncidentActions"
},
"claims": "{...}",
"caller": "me@contoso.com",
"description": "",
"httpRequest": "{...}",
"resourceId": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/IncidentActions",
"resourceGroupName": "CONTOSO-TEST",
"resourceProviderName": "Microsoft.Insights",
"resourceType": "Microsoft.Insights/actionGroups"
}
},
"properties": {}
}
}
Beveiliging
{
"schemaId":"Microsoft.Insights/activityLogs",
"data":{"status":"Activated",
"context":{
"activityLog":{
"channels":"Operation",
"correlationId":"2518408115673929999",
"description":"Failed SSH brute force attack. Failed brute force attacks were detected from the following attackers: [\"IP Address: 01.02.03.04\"]. Attackers were trying to access the host with the following user names: [\"root\"].",
"eventSource":"Security",
"eventTimestamp":"2017-06-25T19:00:32.607+00:00",
"eventDataId":"Sec-07f2-4d74-aaf0-03d2f53d5a33",
"level":"Informational",
"operationName":"Microsoft.Security/locations/alerts/activate/action",
"operationId":"Sec-07f2-4d74-aaf0-03d2f53d5a33",
"properties":{
"attackers":"[\"IP Address: 01.02.03.04\"]",
"numberOfFailedAuthenticationAttemptsToHost":"456",
"accountsUsedOnFailedSignInToHostAttempts":"[\"root\"]",
"wasSSHSessionInitiated":"No","endTimeUTC":"06/25/2017 19:59:39",
"actionTaken":"Detected",
"resourceType":"Virtual Machine",
"severity":"Medium",
"compromisedEntity":"LinuxVM1",
"remediationSteps":"[In case this is an Azure virtual machine, add the source IP to NSG block list for 24 hours (see https://azure.microsoft.com/documentation/articles/virtual-networks-nsg/)]",
"attackedResourceType":"Virtual Machine"
},
"resourceId":"/subscriptions/12345-5645-123a-9867-123b45a6789/resourceGroups/contoso/providers/Microsoft.Security/locations/centralus/alerts/Sec-07f2-4d74-aaf0-03d2f53d5a33",
"resourceGroupName":"contoso",
"resourceProviderName":"Microsoft.Security",
"status":"Active",
"subscriptionId":"12345-5645-123a-9867-123b45a6789",
"submissionTimestamp":"2017-06-25T20:23:04.9743772+00:00",
"resourceType":"MICROSOFT.SECURITY/LOCATIONS/ALERTS"
}
},
"properties":{}
}
}
Aanbeveling
{
"schemaId":"Microsoft.Insights/activityLogs",
"data":{
"status":"Activated",
"context":{
"activityLog":{
"channels":"Operation",
"claims":"{\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress\":\"Microsoft.Advisor\"}",
"caller":"Microsoft.Advisor",
"correlationId":"bbbb1111-cc22-3333-44dd-555555eeeeee",
"description":"A new recommendation is available.",
"eventSource":"Recommendation",
"eventTimestamp":"2017-06-29T13:52:33.2742943+00:00",
"httpRequest":"{\"clientIpAddress\":\"0.0.0.0\"}",
"eventDataId":"1bf234ef-e45f-4567-8bba-fb9b0ee1dbcb",
"level":"Informational",
"operationName":"Microsoft.Advisor/recommendations/available/action",
"properties":{
"recommendationSchemaVersion":"1.0",
"recommendationCategory":"HighAvailability",
"recommendationImpact":"Medium",
"recommendationName":"Enable Soft Delete to protect your blob data",
"recommendationResourceLink":"https://portal.azure.com/#blade/Microsoft_Azure_Expert/RecommendationListBlade/recommendationTypeId/12dbf883-5e4b-4f56-7da8-123b45c4b6e6",
"recommendationType":"12dbf883-5e4b-4f56-7da8-123b45c4b6e6"
},
"resourceId":"/subscriptions/12345-5645-123a-9867-123b45a6789/resourceGroups/contoso/providers/microsoft.storage/storageaccounts/contosoStore",
"resourceGroupName":"CONTOSO",
"resourceProviderName":"MICROSOFT.STORAGE",
"status":"Active",
"subStatus":"",
"subscriptionId":"12345-5645-123a-9867-123b45a6789",
"submissionTimestamp":"2017-06-29T13:52:33.2742943+00:00",
"resourceType":"MICROSOFT.STORAGE/STORAGEACCOUNTS"
}
},
"properties":{}
}
}
ServiceHealth
{
"schemaId": "Microsoft.Insights/activityLogs",
"data": {
"status": "Activated",
"context": {
"activityLog": {
"channels": "Admin",
"correlationId": "cccc2222-dd33-4444-55ee-666666ffffff",
"description": "Active: Virtual Machines - Australia East",
"eventSource": "ServiceHealth",
"eventTimestamp": "2017-10-18T23:49:25.3736084+00:00",
"eventDataId": "6fa98c0f-334a-b066-1934-1a4b3d929856",
"level": "Informational",
"operationName": "Microsoft.ServiceHealth/incident/action",
"operationId": "cccc2222-dd33-4444-55ee-666666ffffff",
"properties": {
"title": "Virtual Machines - Australia East",
"service": "Virtual Machines",
"region": "Australia East",
"communication": "Starting at 02:48 UTC on 18 Oct 2017 you have been identified as a customer using Virtual Machines in Australia East who may receive errors starting Dv2 Promo and DSv2 Promo Virtual Machines which are in a stopped "deallocated" or suspended state. Customers can still provision Dv1 and Dv2 series Virtual Machines or try deploying Virtual Machines in other regions, as a possible workaround. Engineers have identified a possible fix for the underlying cause, and are exploring implementation options. The next update will be provided as events warrant.",
"incidentType": "Incident",
"trackingId": "0NIH-U2O",
"impactStartTime": "2017-10-18T02:48:00.0000000Z",
"impactedServices": "[{\"ImpactedRegions\":[{\"RegionName\":\"Australia East\"}],\"ServiceName\":\"Virtual Machines\"}]",
"defaultLanguageTitle": "Virtual Machines - Australia East",
"defaultLanguageContent": "Starting at 02:48 UTC on 18 Oct 2017 you have been identified as a customer using Virtual Machines in Australia East who may receive errors starting Dv2 Promo and DSv2 Promo Virtual Machines which are in a stopped "deallocated" or suspended state. Customers can still provision Dv1 and Dv2 series Virtual Machines or try deploying Virtual Machines in other regions, as a possible workaround. Engineers have identified a possible fix for the underlying cause, and are exploring implementation options. The next update will be provided as events warrant.",
"stage": "Active",
"communicationId": "636439673646212912",
"version": "0.1.1"
},
"status": "Active",
"subscriptionId": "cccc2c2c-dd3d-ee4e-ff5f-aaaaaa6a6a6a",
"submissionTimestamp": "2017-10-18T23:49:28.7864349+00:00"
}
},
"properties": {}
}
}
Zie Servicestatus meldingen voor Servicestatus meldingen voor specifieke schemadetails over waarschuwingen voor activiteitenlogboeken voor servicestatussen. U kunt ook leren hoe u webhookmeldingen voor servicestatus configureert met uw bestaande oplossingen voor probleembeheer.
ResourceHealth
{
"schemaId": "Microsoft.Insights/activityLogs",
"data": {
"status": "Activated",
"context": {
"activityLog": {
"channels": "Admin, Operation",
"correlationId": "dddd3333-ee44-5555-66ff-777777aaaaaa",
"eventSource": "ResourceHealth",
"eventTimestamp": "2018-09-04T23:09:03.343+00:00",
"eventDataId": "2b37e2d0-7bda-4de7-ur8c6-1447d02265b2",
"level": "Informational",
"operationName": "Microsoft.Resourcehealth/healthevent/Activated/action",
"operationId": "2b37e2d0-7bda-489f-81c6-1447d02265b2",
"properties": {
"title": "Virtual Machine health status changed to unavailable",
"details": "Virtual machine has experienced an unexpected event",
"currentHealthStatus": "Unavailable",
"previousHealthStatus": "Available",
"type": "Downtime",
"cause": "PlatformInitiated"
},
"resourceId": "/subscriptions/<subscription Id>/resourceGroups/<resource group>/providers/Microsoft.Compute/virtualMachines/<resource name>",
"resourceGroupName": "<resource group>",
"resourceProviderName": "Microsoft.Resourcehealth/healthevent/action",
"status": "Active",
"subscriptionId": "<subscription Id>",
"submissionTimestamp": "2018-09-04T23:11:06.1607287+00:00",
"resourceType": "Microsoft.Compute/virtualMachines"
}
}
}
}
Naam van element | Beschrijving |
---|---|
status | Wordt gebruikt voor waarschuwingen voor metrische gegevens. Altijd ingesteld op activated waarschuwingen voor activiteitenlogboeken. |
context | Context van de gebeurtenis. |
resourceProviderName | De resourceprovider van de betrokken resource. |
conditionType | Altijd Event . |
naam | Naam van de waarschuwingsregel. |
Id | Resource-id van de waarschuwing. |
beschrijving | De beschrijving van de waarschuwing wordt ingesteld wanneer de waarschuwing wordt gemaakt. |
subscriptionId | Azure-abonnements-id. |
timestamp | Tijdstip waarop de gebeurtenis is gegenereerd door de Azure-service die de aanvraag heeft verwerkt. |
resourceId | Resource-id van de betreffende resource. |
resourceGroupName | Naam van de resourcegroep voor de betreffende resource. |
properties | <Key, Value> Set paren (dat wil Dictionary<String, String> gezegd, ) met details over de gebeurtenis. |
gebeurtenis | Element met metagegevens over de gebeurtenis. |
autorisatie | De eigenschappen van op rollen gebaseerd toegangsbeheer van Azure van de gebeurtenis. Deze eigenschappen omvatten meestal de actie, de rol en het bereik. |
category | Categorie van de gebeurtenis. Ondersteunde waarden zijn onder andere Administrative , Alert , Security , ServiceHealth en Recommendation . |
beller | E-mailadres van de gebruiker die de bewerking, UPN-claim of SPN-claim heeft uitgevoerd op basis van beschikbaarheid. Kan null zijn voor bepaalde systeemoproepen. |
correlationId | Meestal een GUID in tekenreeksindeling. Gebeurtenissen met correlationId behoren tot dezelfde grotere actie en delen meestal een correlationId . |
eventDescription | Statische tekstbeschrijving van de gebeurtenis. |
eventDataId | Unieke id voor de gebeurtenis. |
eventSource | Naam van de Azure-service of -infrastructuur die de gebeurtenis heeft gegenereerd. |
httpRequest | De aanvraag bevat meestal de clientRequestId methode , clientIpAddress en HTTP (bijvoorbeeld PUT). |
niveau | Een van de volgende waarden: Critical , Error , Warning en Informational . |
operationId | Meestal wordt een GUID gedeeld tussen de gebeurtenissen die overeenkomen met één bewerking. |
operationName | Naam van de bewerking. |
properties | Eigenschappen van de gebeurtenis. |
status | Snaar. Status van de bewerking. Algemene waarden zijn onder andere Started , In Progress , Succeeded , Failed en Resolved Active . |
subStatus | Bevat meestal de HTTP-statuscode van de bijbehorende REST-aanroep. Het kan ook andere tekenreeksen bevatten die een substatus beschrijven. Algemene substatuswaarden zijn onder andere OK (HTTP-statuscode: 200), Created (HTTP-statuscode: 201), Accepted (HTTP-statuscode: 202), No Content (HTTP-statuscode: 204), Bad Request (HTTP-statuscode: 400), Not Found (HTTP-statuscode: 404 Internal Server Error ), Conflict (HTTP-statuscode: 500), Service Unavailable (HTTP-statuscode: 503) en Gateway Timeout (HTTP-statuscode: 504). |
Zie Overzicht van het Azure-activiteitenlogboek voor specifieke schemadetails over alle andere waarschuwingen voor activiteitenlogboeken.
Volgende stappen
- Meer informatie over het activiteitenlogboek.
- Azure Automation-scripts (Runbooks) uitvoeren op Azure-waarschuwingen.
- Gebruik een logische app om een sms via Twilio te verzenden vanuit een Azure-waarschuwing. Dit voorbeeld is bedoeld voor waarschuwingen voor metrische gegevens, maar kan worden gewijzigd om te werken met een waarschuwing voor activiteitenlogboeken.
- Gebruik een logische app om een Slack-bericht te verzenden vanuit een Azure-waarschuwing. Dit voorbeeld is bedoeld voor waarschuwingen voor metrische gegevens, maar kan worden gewijzigd om te werken met een waarschuwing voor activiteitenlogboeken.
- Gebruik een logische app om vanuit een Azure-waarschuwing een bericht naar een Azure-wachtrij te verzenden. Dit voorbeeld is bedoeld voor waarschuwingen voor metrische gegevens, maar kan worden gewijzigd om te werken met een waarschuwing voor activiteitenlogboeken.