Skip to main content

Sync Logs & Monitoring

Every sync run produces a structured log entry in the middleware database. These logs power the Sync Logs admin page and provide an audit trail for debugging and capacity planning.


NFusionSyncLog

Model: app/Models/NFusionSyncLog.php

Each sync run creates one NFusionSyncLog record per sync target.

ColumnDescription
n_fusion_tenant_idWhich tenant was synced
n_fusion_sync_target_idWhich target received the sync
statusrunning / success / partial / error
started_atWhen the sync job started
completed_atWhen it finished
records_attemptedTotal SKU count from nFusion
records_processedNumber of SKUs successfully updated
messageHuman-readable description including a spot price summary (e.g. Spot prices: Gold A:4550.9300 B:4548.9300; Silver A:72.0540 B:71.2040; Platinum A:1893.2000 B:1883.2000.)
spot_prices_snapshotJSON snapshot of metal spot prices captured during this run (nullable)

Spot Prices Snapshot

When the WooCommerce sync target successfully fetches spot prices, the normalised snapshot is persisted to the log record:

{
"gold": { "ask": 4550.93, "bid": 4548.93 },
"silver": { "ask": 72.054, "bid": 71.204 },
"platinum": { "ask": 1893.20, "bid": 1883.20 }
}

This is displayed in the Spot Prices Snapshot section of the log detail view in Filament. If the nFusion General API call failed during that run the column will be null.


NFusionSyncLogItem

Model: app/Models/NFusionSyncLogItem.php

Per-SKU detail records linked to a parent NFusionSyncLog. Created when debug_enabled = true on the sync target. Each item records:

ColumnDescription
n_fusion_sync_log_idParent log
skuProduct SKU
statussuccess or error
messageWhat happened (e.g., "price updated", "SKU not found")
dataJSON snapshot of the price data for this SKU

Status Values

StatusMeaning
runningThe job is currently in progress
successAll attempted SKUs processed without errors
partialSome SKUs processed, some failed
errorThe sync failed entirely (exception thrown)

Viewing Logs in Filament

  1. Navigate to nFusion → Sync Logs.
  2. Filter by tenant, target, status, or date range.
  3. Click a log entry to view per-SKU items (if debug mode was enabled).

Error Notifications

When a sync fails, PriceSyncService sends an email notification via NFusionSyncErrorMail. Configure the recipient in .env:


Healthcheck Monitoring

If a tenant has a healthcheck_url configured, a successful sync pings that URL. You can use services like Healthchecks.io to alert when syncs stop happening — for example if the queue worker goes down.


Application Logs

All sync activity is also written to Laravel's application log (typically storage/logs/laravel.log):

# Tail logs locally
tail -f storage/logs/laravel.log

# View in Vapor / CloudWatch
# Logs are sent to AWS CloudWatch when deployed on Vapor

Log channels are configured in config/logging.php.