What audit and logging components constitute a robust enterprise integration monitoring framework?
Answer
Basics: Integrations fail silently unless you build visibility. A logging framework captures each inbound and outbound call so support teams can answer "did this message arrive, what did we send, and why did it fail?". Auditing is the compliance side: proving who changed what and when.
How it works: Typical components:
- Integration log record (custom object such as
Integration_Log__c): correlation ID, direction, endpoint/operation, HTTP status, latency, record IDs, status (Success, Failed, Retrying), retry count, and truncated request/response bodies. - Correlation ID generated at the origin and passed in a header through middleware and back, so one business transaction can be traced across systems.
- Error capture in try/catch blocks around callouts and in Apex REST handlers, storing exception type, message and stack trace.
- Alerting and retry: a scheduled or queueable job re-processes Failed rows with a retry cap; a report/dashboard or Flow notifies owners.
- Platform audit sources: Setup Audit Trail (180 days), Field History/Field Audit Trail, Login History, and Event Monitoring.
Advanced / deep dive: A log written with ordinary DML is rolled back when the transaction fails, which is exactly when you need it. Publish a platform event (publish behavior "Publish Immediately") or log from a separate transaction so the record survives. Log volume can reach millions of rows, so archive to Big Objects or an external store and purge with batch jobs. Mask PII and secrets before logging; request bodies often contain regulated data, and log objects need tight sharing. Event Monitoring (paid add-on, formerly part of Shield) provides ApiEvent, RestApiEvent, LoginEvent and Event Log Files for who-called-the-API analysis, but Event Log Files are retained for a limited time (commonly 30 days; verify in current docs). Middleware (MuleSoft and similar) should emit its own logs using the same correlation ID.