Skip to main content

Automate log syncing

Keep Log Lens up to date by running connector syncs on a schedule.

Laravel

Add the command to your scheduler (routes/console.php or the console kernel):

use Illuminate\Support\Facades\Schedule;

Schedule::command('log-lens:sync')->everyFiveMinutes()->withoutOverlapping();

The same command is also the fallback worker for dashboard-queued runs. An invocation that finds durable queued confirmations services that queue; when no queue exists it performs the normal scheduled connector synchronization.

Sync a single connector with log-lens:sync --connector=2, or a specific workspace with --app=<id>.

Standalone (cron)

*/5 * * * * cd /path/to/log-lens && php bin/sync.php >> /var/log/log-lens-sync.log 2>&1

Good to know

  • Each connector is locked during a sync, so overlapping runs are safe - a second run of the same connector is skipped, not duplicated.
  • Only appended bytes are fetched each run, so frequent syncs are cheap.
  • A sync resumes from its last checkpoint after any interruption.
  • The dashboard's "Sync now" launches a detached background worker for immediacy; if that can't start (locked-down host, no shell), the run stays queued for the scheduled command. For reliable, unattended operation the scheduled drain is the recommended path — run log-lens:sync (Laravel) or bin/sync.php on a schedule and it drains queued runs and starts new ones.
  • If a worker is killed mid-sync (crash, deploy, reboot), its run is automatically marked failed once it stops advancing for sync.stale_run_timeout_seconds (default 900s), so nothing lingers as "running"; the connector is then free for the next scheduled run.

Prune old archives automatically

Pair syncing with retention so the processed/ archive doesn't grow forever - set retention.processed_max_age_days or processed_max_files in your config. See Maintenance.