#Cleanup & Maintenance
iSyncSF generates audit logs, application logs, and sync job records during every sync operation. Over time these records consume Salesforce data storage and can impact query performance. This guide covers how to manage data retention using both scheduled and manual cleanup tools.
#Why Regular Cleanup Matters
Every sync operation creates records that track what happened during the job. While these records are essential for monitoring, troubleshooting, and rollback, they accumulate quickly:
- Audit logs (DataSyncAuditLog) store one record per synced record, including source ID, destination ID, status, and error details. High-volume syncs can create millions of audit log records.
- Application logs (ApplicationLog) capture operational events, warnings, and errors during sync execution. Higher debug levels generate significantly more log records.
- Sync job records (DataSyncJob and DataSyncChildJob) track each sync run and its sub-jobs.
Without regular cleanup, these records consume Salesforce data storage, slow down list views and reports on iSyncSF objects, and can push your org toward storage limits. Additionally, audit log records are required for rollback and retry operations — but only for recent sync jobs. Retaining audit logs indefinitely provides no benefit and creates unnecessary storage pressure.
#Application Log Cleanup
Manual Cleanup
Each DataSyncTemplate record page includes a Delete Application Logs button in the toolbar. Clicking this button opens a confirmation dialog, and upon confirmation, deletes all Application Log records associated with that specific template.
- If the number of log records is small enough to delete in a single transaction, they are removed immediately.
- If the log volume exceeds single-transaction limits, a background job is automatically started to handle the deletion. You will see a confirmation message indicating that a batch deletion has been initiated.
Automatic Pre-Sync Cleanup
iSyncSF automatically clears old Application Log records for a template before starting a new sync run (except on retry operations). This ensures that logs from previous runs do not accumulate indefinitely, even if you never use the manual delete button.
Scheduled Cleanup
The Application Log Cleanup Job runs on a configurable CRON schedule (default: daily at 3:00 AM) and removes Application Log records older than the configured retention period (default: 60 days). See the Scheduled Cleanup Jobs section below for configuration details.
#Audit Log Retention
DataSyncAuditLog records are the most storage-intensive objects in iSyncSF. Each record stores the source record ID, destination record ID, status code, error messages, and relationship metadata. A single sync operation creates one audit log record for every record processed.
Default Retention
The default retention period for audit logs is 90 days. Records older than 90 days are automatically purged by the scheduled cleanup job.
Important Considerations
- Rollback dependency: Rollback operations rely on audit log records to identify which records were inserted in the target org. If audit logs for a sync job are deleted, rollback for that job is no longer possible. Ensure the retention period is long enough to cover your rollback window.
- Retry dependency: The Retry function on the Execute tab uses audit log records to identify failed records for reprocessing. Delete audit logs only after you are confident that no retry is needed.
- Sync job records: The default retention period for master sync job records (DataSyncJob) is 180 days. These are smaller records but should also be cleaned up periodically.
#Scheduled Cleanup Jobs
iSyncSF includes three pre-configured scheduled cleanup jobs that run automatically once enabled. These jobs are managed through the Setup Assistant under the Scheduled Jobs tab.
| Job Name | Object Cleaned | Default Retention | Default Schedule |
|---|---|---|---|
| Audit Log Cleanup | DataSyncAuditLog | 90 days | Daily at 2:00 AM |
| Application Log Cleanup | ApplicationLog | 60 days | Daily at 3:00 AM |
| Sync Job Cleanup | DataSyncJob | 180 days | Weekly on Sunday at 4:00 AM |
Enabling Cleanup Jobs
- Open the iSyncSF app and navigate to the Setup Assistant.
- Go to the Scheduled Jobs tab.
- Click Apply Recommended Settings to enable all three cleanup jobs with their default retention periods and schedules.
- Alternatively, configure each job individually by setting a custom CRON expression and retention period (in days).
Customizing Retention Periods
You can adjust the retention period for each cleanup job from the Scheduled Jobs tab. For example:
- Set Audit Log retention to 30 days if you do not need rollback capability beyond one month.
- Set Application Log retention to 14 days if you review logs promptly after each sync.
- Extend Sync Job retention to 365 days if you need long-term sync history for auditing.
Staggered Scheduling
The three cleanup jobs are scheduled at different times (2 AM, 3 AM, and 4 AM) to avoid competing for batch job slots. Salesforce allows a maximum of five concurrent batch jobs, and cleanup jobs should not interfere with active sync operations. If you customize the schedules, maintain at least a one-hour gap between cleanup jobs.
Managing Scheduled Jobs
From the Scheduled Jobs tab in the Setup Assistant, you can:
- View status: See whether each job is active, its next scheduled run time, and the number of times it has fired.
- Reschedule: Change the CRON schedule or retention period for any job.
- Abort: Stop a scheduled job if it is no longer needed.
#Manual Cleanup Options
In addition to scheduled cleanup, iSyncSF provides several manual cleanup options:
Delete Application Logs for a Specific Template
Navigate to any DataSyncTemplate record page and click the Delete Application Logs button. This removes all Application Log records linked to that template, which is useful for clearing logs before a fresh sync run or after investigating an issue.
Legacy Data Cleanup
For advanced cleanup scenarios, iSyncSF includes a legacy cleanup tool that can:
- Delete audit log records older than a specified number of days.
- Filter by a specific template.
- Optionally cascade the deletion to the parent sync job records.
- Send an email notification when the cleanup completes.
Bulk Record Deletion via Data Loader
For very large volumes of audit log records that need to be removed quickly, you can use Salesforce Data Loader to export and bulk-delete DataSyncAuditLog records. This approach is faster for one-time cleanup of millions of records but requires familiarity with Data Loader operations.
Review Storage Usage
Monitor your Salesforce data storage from Setup → Storage Usage. Look for growth in the Custom Objects category, which includes all iSyncSF objects. If storage is approaching limits, reduce retention periods or run a manual cleanup.
#Storage Impact Estimates
Use these rough estimates to plan your storage needs and cleanup schedules:
| Object | Approximate Size per Record | Example: 100,000 records synced |
|---|---|---|
| DataSyncAuditLog | ~2 KB | ~200 MB |
| ApplicationLog | ~1 KB | ~50 MB (varies by log level) |
| DataSyncJob + Child Jobs | ~1 KB per child job | ~5 MB |
Each synced record generates approximately one audit log record at roughly 2 KB. A 100,000-record sync therefore creates approximately 200 MB of audit log data. For orgs running daily syncs at this volume, audit logs alone can accumulate several gigabytes per month without cleanup.
Recommendations
- Always enable scheduled cleanup jobs. This is the single most important maintenance task for iSyncSF.
- Start with default retention periods (90/60/180 days) and adjust based on your actual storage consumption and rollback needs.
- Review storage monthly during the first few months of using iSyncSF to understand your specific growth patterns.
- Reduce the DebugLevel system property to
ERRORin production to minimize Application Log volume. Higher log levels (DEBUG,FINEST) generate significantly more log records. - Schedule regular cleanup to keep storage under control and maintain healthy query performance on iSyncSF objects.