Bagikan melalui


Enable Diagnostic Logging in Azure API for FHIR

Penting

Azure API untuk FHIR akan dihentikan pada 30 September 2026. Ikuti strategi migrasi untuk beralih ke layanan FHIR® Azure Health Data Services pada tanggal tersebut. Karena pensiunnya Azure API untuk FHIR, penerapan untuk pelanggan baru tidak akan diizinkan mulai 1 April 2025. Layanan Azure Health Data Services FHIR adalah versi Azure API yang berkembang untuk FHIR yang memungkinkan pelanggan mengelola layanan FHIR, DICOM, dan MedTech dengan integrasi ke layanan Azure lainnya.

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. Pilih Simpan

Nota

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.

Nama Bidang Tipe Catatan
CallerIdentity Dynamic A generic property bag containing identity information
CallerIdentityIssuer String Issuer
CallerIdentityObjectId String Object_Id
Alamat IP Pemanggil String The caller’s IP address
CorrelationId String Correlation ID
FhirResourceType String The resource type for which the operation was executed
LogCategory String The log category (currently returning ‘AuditLogs’ LogCategory)
Lokasi String 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
Nama Operasi String Describes the type of operation (for example, update, search-type)
RequestUri String The request URI
Tipe Hasil String The available values currently are Started, Succeeded, or Failed
Status Kode Int The HTTP status code. (for example, 200)
TimeGenerated Tanggal dan Waktu Date and time of the event
Karakteristik String Describes the properties of the fhirResourceType
SourceSystem String Source System (always Azure in this case)
ID Penyewa String ID Penyewa
Tipe String Type of log (always MicrosoftHealthcareApisAuditLog in this case)
_ResourceId String Details about the resource

Contoh pertanyaan

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" 

Kesimpulan

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.

Langkah berikutnya

In this article, you learned how to enable Audit Logs for Azure API for FHIR. Untuk informasi tentang Azure API untuk pengaturan konfigurasi FHIR, lihat

Nota

FHIR® adalah merek dagang terdaftar HL7 dan digunakan dengan izin HL7.