Delen via


Azure Managed Instance voor Apache Cassandra bewaken met behulp van Azure Monitor

Azure Managed Instance voor Apache Cassandra biedt metrische gegevens en diagnostische logboekregistratie via Azure Monitor.

Metrische gegevens van Azure Managed Instance voor Apache Cassandra

U kunt metrische gegevens visualiseren voor Azure Managed Instance voor Apache Cassandra in Azure Portal door naar uw clusterresource te gaan en metrische gegevens te selecteren. U kunt vervolgens kiezen uit de beschikbare metrische gegevens en aggregaties.

Screenshot that shows the Metrics pane in the Azure portal.

Diagnostische instellingen in Azure

Azure Monitor maakt gebruik van diagnostische instellingen voor het verzamelen van resourcelogboeken, ook wel gegevensvlaklogboeken genoemd. Een Azure-resource verzendt resourcelogboeken om uitgebreide, frequente gegevens over de bewerkingen te bieden. Azure Monitor legt deze logboeken vast per aanvraag. Voorbeelden van gegevensvlakbewerkingen zijn verwijderen, invoegen en readFeed. De inhoud van deze logboeken verschilt per resourcetype.

Metrische platformgegevens en activiteitenlogboeken worden automatisch verzameld, terwijl u een diagnostische instelling moet maken om resourcelogboeken te verzamelen of om ze buiten Azure Monitor door te sturen. U kunt diagnostische instellingen inschakelen voor Azure Managed Instance voor Apache Cassandra-clusterresources en resourcelogboeken verzenden naar de volgende bronnen:

  • Log Analytics-werkruimte. Gegevens die naar Log Analytics-werkruimten worden verzonden, worden geschreven naar Azure Diagnostics-tabellen (verouderd) of resourcespecifieke (preview) -tabellen.
  • Event Hub.
  • Opslagaccount.

Notitie

U wordt aangeraden de diagnostische instelling te maken in de resourcespecifieke modus.

Diagnostische instellingen maken via Azure Portal

  1. Meld u aan bij het Azure-portaal.

  2. Ga naar uw Azure Managed Instance voor Apache Cassandra-clusterresource.

    Screenshot that shows selecting a cluster from a list of resources.

  3. Selecteer Diagnostische instellingen in de sectie Bewaking en selecteer vervolgens Diagnostische instelling toevoegen.

    Screenshot that shows the pane for diagnostic settings and the button for adding a diagnostic setting.

  4. Kies in het deelvenster Diagnostische instelling een naam voor uw instelling.

    Selecteer vervolgens onder Categoriedetails uw categorieën. In de categorie CassandraLogs worden cassandra-serverbewerkingen vastgelegd. De categorie CassandraAudit registreert audit- en Cassandra Query Language-bewerkingen (CQL).

    Kies onder Doelgegevens de gewenste bestemming voor uw logboeken. Als u logboeken naar een Log Analytics-werkruimte verzendt, selecteert u Resourcespecifiek als doeltabel.

    Screenshot that shows selections for a diagnostic setting.

    Notitie

    Als u logboeken naar een Log Analytics-werkruimte verzendt, kan het tot 20 minuten duren voordat deze worden weergegeven. Tot die tijd zijn de resourcespecifieke tabellen (weergegeven onder Azure Managed Instance voor Apache Cassandra) niet zichtbaar.

  5. Nadat u diagnostische logboekregistratie en gegevens hebt ingesteld, kunt u Logboeken selecteren en query's uitvoeren op de beschikbare diagnostische logboeken met behulp van Azure Data Explorer. Zie Logboekquery's in Azure Monitor voor meer informatie over Azure Monitor en Kusto-querytaal.

    Screenshot that shows query logs.

Een diagnostische instelling maken via de Azure CLI

Als u een diagnostische instelling wilt maken met behulp van de Azure CLI, gebruikt u de opdracht az monitor diagnostic-settings create :

    logs='[{"category":"CassandraAudit","enabled":true,"retentionPolicy":{"enabled":true,"days":3}},{"category":"CassandraLogs","enabled":true,"retentionPolicy":{"enabled":true,"days":3}}]'
    resourceId='/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.DocumentDB/cassandraClusters/{CLUSTER_NAME}'
    workspace='/subscriptions/{SUBSCRIPTION_ID}/resourcegroups/{RESOURCE_GROUP}/providers/microsoft.operationalinsights/workspaces/{WORKSPACE_NAME}'

    az monitor diagnostic-settings create  --name tvk-diagnostic-logs-cassandra --resource $resourceId --logs  $logs --workspace $workspace --export-to-resource-specific true

Een diagnostische instelling maken via de REST API

Gebruik de Azure Monitor REST API voor het maken van een diagnostische instelling via de interactieve console.

Notitie

U wordt aangeraden de eigenschap in te Dedicated stellen voor het logAnalyticsDestinationType inschakelen van resourcespecifieke tabellen.

Aanvraag

PUT
https://management.azure.com/{resource-id}/providers/microsoft.insights/diagnosticSettings/service?api-version={api-version}

Kopteksten

Parameters/headers Waarde/beschrijving
name De naam van uw diagnostische instelling
resourceUri subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.DocumentDb/databaseAccounts/{ACCOUNT_NAME}/providers/microsoft.insights/diagnosticSettings/{DIAGNOSTIC_SETTING_NAME}
api-version 2017-05-01-preview
Content-Type application/json

Hoofdtekst

{
    "id": "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.DocumentDb/databaseAccounts/{ACCOUNT_NAME}/providers/microsoft.insights/diagnosticSettings/{DIAGNOSTIC_SETTING_NAME}",
    "type": "Microsoft.Insights/diagnosticSettings",
    "name": "name",
    "location": null,
    "kind": null,
    "tags": null,
    "properties": {
        "storageAccountId": null,
        "serviceBusRuleId": null,
        "workspaceId": "/subscriptions/{SUBSCRIPTION_ID}/resourcegroups/{RESOURCE_GROUP}/providers/microsoft.operationalinsights/workspaces/{WORKSPACE_NAME}",
        "eventHubAuthorizationRuleId": null,
        "eventHubName": null,
        "logs": [
            {
                "category": "CassandraAudit",
                "categoryGroup": null,
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            },
            {
                "category": "CassandraLogs",
                "categoryGroup": null,
                "enabled": true,
                "retentionPolicy": {
                    "enabled": false,
                    "days": 0
                }
            }
        ],
        "logAnalyticsDestinationType": "Dedicated"
    },
    "identity": null
}

Whitelist controleren

Notitie

Dit artikel bevat verwijzingen naar de lijst met toegestane termen, die microsoft niet meer gebruikt. Zodra de term uit de software wordt verwijderd, verwijderen we deze uit dit artikel.

Standaard wordt in auditlogboekregistratie een record gemaakt voor elke aanmeldingspoging en CQL-query. Het resultaat kan overweldigend zijn en de overhead verhogen. Als u deze situatie wilt beheren, kunt u een whitelist gebruiken om selectief specifieke auditrecords op te nemen of uit te sluiten.

Cassandra 3.11

In Cassandra 3.11 kunt u de functie voor de whitelist voor controles gebruiken om in te stellen welke bewerkingen geen controlerecord maken. De whitelistfunctie voor controles is standaard ingeschakeld in Cassandra 3.11. Zie Op rollen gebaseerd whitelist-beheer voor meer informatie over het configureren van uw whitelist.

Voorbeelden:

  • Als u alle SELECT bewerkingen en MODIFY bewerkingen voor de gebruiker bob uit het auditlogboek wilt filteren, voert u de volgende instructies uit:

    cassandra@cqlsh> ALTER ROLE bob WITH OPTIONS = { 'GRANT AUDIT WHITELIST FOR SELECT' : 'data' };
    cassandra@cqlsh> ALTER ROLE bob WITH OPTIONS = { 'GRANT AUDIT WHITELIST FOR MODIFY' : 'data' };
    
  • Als u alle SELECT bewerkingen in de decisions tabel in de design keyspace voor de gebruiker jim uit het auditlogboek wilt filteren, voert u de volgende instructie uit:

    cassandra@cqlsh> ALTER ROLE jim WITH OPTIONS = { 'GRANT AUDIT WHITELIST FOR SELECT' : 'data/design/decisions' };
    
  • Als u de whitelist voor de gebruiker bob wilt intrekken voor alle bewerkingen van SELECT de gebruiker, voert u de volgende instructie uit:

    cassandra@cqlsh> ALTER ROLE bob WITH OPTIONS = { 'REVOKE AUDIT WHITELIST FOR SELECT' : 'data' };
    
  • Als u de huidige whitelists wilt weergeven, voert u de volgende instructie uit:

    cassandra@cqlsh> LIST ROLES;
    

Cassandra 4 en hoger

In Cassandra 4 en hoger kunt u uw whitelist configureren in de Cassandra-configuratie. Zie De configuratie van Cassandra bijwerken voor gedetailleerde richtlijnen. De beschikbare opties zijn als volgt (naslaginformatie: Cassandra-documentatie voor auditlogboekregistratie):

audit_logging_options:
    included_keyspaces: <Comma separated list of keyspaces to be included in audit log, default - includes all keyspaces>
    excluded_keyspaces: <Comma separated list of keyspaces to be excluded from audit log, default - excludes no keyspace except system, system_schema and system_virtual_schema>
    included_categories: <Comma separated list of Audit Log Categories to be included in audit log, default - includes all categories>
    excluded_categories: <Comma separated list of Audit Log Categories to be excluded from audit log, default - excludes no category>
    included_users: <Comma separated list of users to be included in audit log, default - includes all users>
    excluded_users: <Comma separated list of users to be excluded from audit log, default - excludes no user>

De beschikbare categorieën zijn: QUERY, DML, DDL, DCL, OTHER, , AUTH, ERROR. PREPARE

Hier volgt een voorbeeldconfiguratie:

audit_logging_options:
    included_keyspaces: keyspace1,keyspace2
    included_categories: AUTH,ERROR,DCL,DDL

Standaard wordt de configuratie ingesteld included_categories op AUTH,ERROR,DCL,DDL.

Volgende stappen