Heartbeat Monitoring for Laravel

TL;DR

Laravel task scheduling and queue workers can freeze or fail completely due to memory leaks, expired API tokens, or database locks. Because these background tasks happen entirely behind the scenes, your primary Nginx or Apache server will continue running fine, leaving external uptime checkers unaware of the failure. Implementing heartbeat monitoring lets your scheduled console commands send an automated HTTP request upon successful completion, giving you instant alerts if a job fails to run.
A detailed technical infographic titled 'Heartbeat Monitoring Service' showcasing background process monitoring concepts.

Heartbeat overview

Heartbeat monitoring is a specialized but simple type of monitoring used to track the health of processes, applications, or systems by periodically sending "heartbeat" signals to a monitoring service. These signals act as a status indicator, showing that a process or application is functioning as expected. If the heartbeat fails to arrive within a predefined time frame, an alert is triggered to inform web admins of a potential issue.

Create a new Heartbeat check in Acumen Logs

Within the Acumen Logs dashboard, navigate to Heartbeat in the side navigation. Then select the create button and add an identifiable name that you can recognise later. Then press save, you will then be redirected to your Heartbeat dashboard where you will find your unique endpoint which you can then use as shown in the example below.

Let's install a Heartbeat in the Laravel scheduler

1. Open your Laravel project and navigate to the below file.

App\Console\Kernel.php

2. Then within the schedule method call the heartbeat endpoint provided to you within the Acumen Logs dashboard

   
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
   // Task a
   // Task b

   Http::post('https://acumenlogs.com/heartbeat/xxxx-xxxx-xxx-xxx-xxxx/pulse');
}


3. Run your scheduler and you will see the pulse registered in your dashboard

Key Takeaways

  • Laravel background tasks and long-running queue processes regularly encounter silent logic timeouts without disrupting public web traffic configurations.
  • Utilizing built-in framework execution hooks allows you to establish reliable background monitoring paths with zero external server dependencies.
  • Continuous verification of data pipeline schedules protects critical transactional routines like midnight billing cycles and automated cleanups from breaking unnoticed.

Frequently

Asked
Questions

This is the default text value
Up right arrow
How do you track failing cron jobs or background schedules in Laravel?
Up arrow icon
By appending a lightweight HTTP ping function directly to your Laravel scheduler routine. Using Laravel's native task hooks, you can chain a URL dispatch request to execute immediately after a scheduled command finishes. If the task crashes or hits a fatal error mid-execution, the finish hook never fires, causing your external monitoring dashboard to flag the missed check-in.

Not seeing the right fit?
Talk to us, we’ll make it work.

Start catching issues before your customers do, with real browser testing, smart alerts and AI-assisted setup.
No credit card required · Free plan available · Cancel anytime
No credit card requiredFree plan foreverCancel anytimeSet up in 60 seconds