Dela via


Enable Diagnostic Logging in Azure API for FHIR

Viktigt!

Azure API för FHIR avvecklas den 30 september 2026. Följ migreringsstrategierna för att övergå till Azure Health Data Services FHIR-tjänsten® senast det datumet. På grund av att Azure API för FHIR dras tillbaka tillåts inte nya kunddistributioner från och med den 1 april 2025. Azure Health Data Services FHIR-tjänsten är den utvecklade versionen av Azure API för FHIR som gör det möjligt för kunder att hantera FHIR-, DICOM- och MedTech-tjänster med integreringar i andra Azure-tjänster.

In this article, you learn how to enable diagnostic logging in Azure API for FHIR® and be able to review sample queries for these logs. Access to diagnostic logs is essential for any healthcare service where compliance with regulatory requirements (such as HIPAA) is a must. The feature in Azure API for FHIR that enables diagnostic logs is the Diagnostic settings in the Azure portal.

View and Download FHIR Metrics Data

You can view the metrics under Monitoring | Metrics from the portal. The metrics include Number of Requests, Average Latency, Number of Errors, Data Size, request units (RUs) Used, Number of requests that exceeded capacity, and Availability (in %). The Total Request Metrics provides the number of requests reaching the FHIR service. This means requests such as FHIR bundles are considered as single request for logging.

The following screenshot shows RUs used for a sample environment with few activities in the last seven days. You can download the data in JSON format.

Azure API for FHIR Metrics from the portal

Enable audit logs

  1. To enable diagnostic logging in Azure API for FHIR, select your Azure API for FHIR service in the Azure portal

  2. Navigate to Diagnostic settings

    Add Azure FHIR Diagnostic Settings.

  3. Select + Add diagnostic setting

  4. Enter a name for the setting

  5. Select the method you want to use to access your diagnostic logs:

    1. Archive to a storage account for auditing or manual inspection. The storage account you want to use needs to already be created.
    2. Stream to event hub for ingestion by a third-party service or custom analytic solution. You'll need to create an event hub namespace and event hub policy before you can configure this step.
    3. Stream to the Log Analytics workspace in Azure Monitor. You need to create your Logs Analytics Workspace before you can select this option.
  6. Select AuditLogs and/or AllMetrics. The metrics include service name, availability, data size, total latency, total requests, total errors, and timestamp. Find more detail on supported metrics.

    Azure FHIR Diagnostic Settings. Select AuditLogs and/or AllMetrics.

  7. Välj Spara

Anmärkning

It might take up to 15 minutes for the first Logs to show in Log Analytics. Also, if Azure API for FHIR is moved from one resource group or subscription to another, update the setting once the move is complete.

For more information on how to work with diagnostic logs, refer to the Azure Resource Log documentation.

Audit log details

At this time, the Azure API for FHIR service returns the following fields in the audit log.

Fältnamn Typ Noteringar
CallerIdentity Dynamic A generic property bag containing identity information
CallerIdentityIssuer Sträng Utfärdare
CallerIdentityObjectId Sträng Object_Id
Anroparens IP-adress Sträng The caller’s IP address
CorrelationId Sträng Correlation ID
FhirResourceType Sträng The resource type for which the operation was executed
LogCategory Sträng The log category (currently returning ‘AuditLogs’ LogCategory)
Plats Sträng The location of the server that processed the request (for example, South Central US)
OperationDuration Int The time it took to complete this request in seconds. Note : This value is always set to 0, due to a known issue
Operationens namn Sträng Describes the type of operation (for example, update, search-type)
RequestUri Sträng The request URI
Resultattyp Sträng The available values currently are Started, Succeeded, or Failed
Statuskod Int HTTP-statuskoden. (for example, 200)
TimeGenerated Datum och tid Date and time of the event
Egenskaper Sträng Describes the properties of the fhirResourceType
SourceSystem Sträng Source System (always Azure in this case)
Hyresgivarens ID Sträng Hyresgäst-ID
Typ Sträng Type of log (always MicrosoftHealthcareApisAuditLog in this case)
_ResourceId Sträng Details about the resource

Exempelfrågor

Here are a few basic Application Insights queries you can use to explore your log data.

Run the following query to see the 100 most recent logs.

MicrosoftHealthcareApisAuditLogs
| limit 100

Run the following query to group operations by FHIR Resource Type.

MicrosoftHealthcareApisAuditLogs 
| summarize count() by FhirResourceType

Run the following query to get all the failed results.

MicrosoftHealthcareApisAuditLogs 
| where ResultType == "Failed" 

Slutsats

Having access to diagnostic logs is essential for monitoring a service and providing compliance reports. Azure API for FHIR allows you to take these actions through diagnostic logs.

Nästa steg

In this article, you learned how to enable Audit Logs for Azure API for FHIR. För information om konfigurationsinställningarna för Azure API för FHIR, se

Anmärkning

FHIR® är ett registrerat varumärke som tillhör HL7 och används med tillstånd av HL7.