Taction Software — FHIR Integration with Mirth Connect
Compliance & Security

PHI in Logs: How to Actually Avoid It in Mirth Connect

PHI in logs is one of the quieter compliance risks in a Mirth Connect deployment, since logs exist specifically to help you troubleshoot, and troubleshooting a message-processing failure often means looking directly at the message content that caused the problem, which is exactly where protected health information tends to end up unintentionally. Unlike a database breach, which is obviously a serious incident, PHI sitting in a debug log file that's never properly secured or purged is a slower, easier-to-overlook exposure that still carries genuine compliance risk.

Below is where PHI actually tends to leak into logs, practical scrubbing and masking strategies, and the log-level discipline that prevents this from happening in the first place. If you suspect PHI is currently sitting in your logs, our free Mirth Health Check can review your logging configuration directly — part of the Mirth Connect support work we do for US healthcare teams.

Where PHI Actually Tends to Leak Into Logs

Understanding the specific, common places PHI ends up in logs unintentionally is the first step toward actually preventing it, since most exposure happens through predictable, avoidable patterns rather than deliberate logging of sensitive data.

Error Messages That Include Full Message Content

When a transformer script throws an exception, many default error-handling patterns log the entire message content alongside the error for debugging convenience, inadvertently writing PHI directly into the log file every time that error occurs.

Debug-Level Logging Left Enabled in Production

Debug-level logging often captures far more detail than standard operational logging, including raw message content during normal processing, and leaving this enabled in production significantly increases how much PHI ends up logged unnecessarily.

Stack Traces That Embed Variable Values

Stack traces from custom script errors can include the actual variable values in play at the time of failure, which may directly contain patient names, identifiers, or clinical data depending on what the failing script was processing.

Third-Party Library Logging You Don't Directly Control

Libraries or extensions used within custom transformer code may have their own logging behavior that captures data you didn't explicitly choose to log, requiring awareness of what those dependencies actually write to logs by default.

Practical Scrubbing and Masking Strategies

Once you understand where PHI tends to leak, specific scrubbing and masking techniques can prevent it from reaching log files in the first place, without sacrificing the diagnostic value logs provide.

Redacting Specific Fields Before Logging Errors

Build error-handling logic that explicitly redacts or omits known PHI fields, like patient name or medical record number, before writing any error context to the log, rather than logging the raw message unfiltered. See our error handling patterns guide for the broader pattern.

Logging Message Metadata Instead of Full Content

Where possible, log identifying metadata like message control ID and channel name rather than full message content, giving you enough context to investigate an issue without directly exposing the underlying PHI in the log itself.

Using Pattern-Based Masking for Known PHI Formats

For cases where full redaction isn't practical, pattern-based masking that obscures likely PHI formats, like partially masking what appears to be a Social Security number, reduces exposure while still preserving some diagnostic value.

Reviewing Custom Scripts Specifically for Logging Behavior

Audit custom transformer and filter scripts specifically for any logging statements they contain, since a well-intentioned developer debugging statement can easily become a permanent, overlooked source of PHI exposure in production logs.

Log-Level Discipline That Prevents This From Recurring

Beyond one-time scrubbing fixes, establishing genuine ongoing discipline around log levels and review prevents PHI exposure from creeping back into your logs over time as channels are modified.

Keeping Production Log Levels at an Appropriate Baseline

Set production log levels to capture what's genuinely needed for operational monitoring without the excessive detail debug-level logging provides, reserving that more verbose level specifically for temporary, deliberate troubleshooting sessions.

Returning Debug Logging to Normal After Troubleshooting

If you temporarily raise log verbosity to diagnose a specific issue, treat returning it to normal afterward as a required step, not an optional cleanup task that might get forgotten once the immediate problem is resolved.

Reviewing Logging Configuration During Code Review

Include logging behavior as part of your regular code review process for new or modified transformer scripts, catching PHI-exposing logging statements before they ever reach a production deployment in the first place.

Auditing Existing Logs Periodically for PHI Exposure

Periodically sample existing log files to check for unintended PHI exposure, since this catches gaps in logging discipline that may have developed gradually rather than waiting to discover them during an actual compliance audit.

Suspect PHI is currently sitting in your logs?

Start with a free Mirth Health Check to review your logging configuration, send us the exact error if you're troubleshooting something specific, or check pricing for our support plans.

FAQ

Frequently Asked Questions

Is it ever acceptable to log full message content?
Generally this should be avoided in production logging, since it directly exposes PHI. If you genuinely need message-level detail for troubleshooting, treat that access with the same care and access controls as PHI stored anywhere else.
Does debug-level logging always expose more PHI than standard logging?
Typically yes, since debug logging is specifically designed to capture more processing detail, often including raw message content, which is exactly the kind of data that shouldn't be logged unnecessarily in a standard production environment.
Can third-party library logging expose PHI without my direct knowledge?
Yes, libraries or extensions used within custom scripts may log data according to their own internal behavior, so review what any dependency you're using actually logs by default rather than assuming it only logs what you explicitly instruct.
How do I check if PHI is currently sitting in my existing logs?
Sample existing log files and search specifically for patterns resembling patient names, identifiers, or other PHI formats, treating any findings as requiring both immediate remediation and a review of what logging behavior caused the exposure.
Should error logs ever include patient identifiers for troubleshooting?
Prefer logging a message control ID or other non-PHI identifier that still lets you trace the specific message in your system, rather than logging an actual patient identifier directly into a log file unnecessarily.
Who should have access to view logs that might contain PHI?
Restrict log access to those who genuinely need it for troubleshooting or system administration, applying the same least-privilege access principle you'd apply to any other system or data source containing protected health information.

Need expert Mirth Connect support?

Whether you have a one-time integration project or need ongoing managed support, every engagement is named, scoped, and priced upfront — productized packages, no hourly billing.

Talk to a Mirth Solutions Architect

60-second form. Senior engineer responds within one business day.

What is 6 + 1 ?