Log Streaming
These instructions primarily apply to self-hosted users. To set up log streaming on the Medplum Hosted instance, please reach out to info@medplum.com
Medplum can be configured to stream service logs to your existing log management tools, like SumoLogic, DataDog, or Splunk. Centralizing log management allows for better observability and auditability, and offers real-time analytics capabilities.
Medplum Logs
Medplum uses AWS CloudWatch to store server logs.
The Medplum server logs:
- All RESTful interactions with FHIR resources
- Login Attempts
- Other troubleshooting information
Forwarding Logs via AWS Lambda
To forward logs from CloudWatch to external platforms, AWS Lambda functions are utilized. This involves creating Lambda functions that are triggered by new log entries in CloudWatch and are configured to push these logs to the chosen external logging system.
- For SumoLogic: Setup Guide
- For DataDog: Setup Guide
- For Splunk: Setup Guide
Log Correlation
Medplum uses includes both request IDs and trace IDs to aid in log correlation, enhancing debugging and monitoring capabilities.
The request ID is automatically generated by the Medplum server for each unique HTTP request.
Clients can pass in their own trace id in their request headers. Medplum supports both the headers X-TRACE-ID
or traceparent
.
Example: Adding a trace id to a medplum GET request
- Typescript
- cURL
await medplum.readResource('Patient', 'homer-simpson', {
headers: {
'X-TRACE-ID': 'MY-TRACE-ID',
},
});
curl https://api.medplum.com/fhir/R4/Patient/homer-simpson \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/fhir+json" \
-H "X-TRACE-ID: "MY-TRACE-ID