Heartbeat Monitors

FlexLogs Docs Image

A Heartbeat is a lightweight “are-you-alive?” signal you drop into your logs. FlexLogs watches for these signals and pings you the moment one is late. No agents, no health-check endpoints, just a log line.

How it works: when a log entry containing a {heartbeat: "name"} tag appears, the timer for that Heartbeat resets. If nothing checks in before the interval you specify, we’ll fire an alert to Slack, e-mail, or whatever integration you’ve configured.

Common use-cases:

  • Make sure a key loop (or important part) of your application runs at least once every minute.
  • Verify a nightly backup script finished (and alert if it didn’t).
  • Ensure a cron-driven billing job runs every 15 minutes.
  • Catch stuck message queues by checking that a “queue drained” log appears at least hourly.
  • Confirm third-party webhooks still arrive on schedule.

Setup is one log line. Add the tag to the code you want to monitor, pick an interval, and you’re done. Heartbeats cost nothing until they actually save your bacon.

Quickstart

    
      
    // create / check-in — just log it
    logger.info("flexlogs{heartbeat: 'db-backup'}");
    // emit this every time the job succeeds (e.g. after the backup finishes)
  
    
  

Options

Key Description Type / Options Default
heartbeat Unique name for the Heartbeat String
interval How long FlexLogs should wait for the next check-in Duration (900, 10m, 1h30m) 3600 / 1h
tags Arbitrary labels (env, team, etc.) Array of strings []

Examples

    
      
    // 1-hour heartbeat using seconds
    logger.info("flexlogs{heartbeat: 'hourly-job', interval: '3600'}");

    // 10-minute heartbeat using shorthand
    logger.info("flexlogs{heartbeat: 'quick-poll', interval: '10m'}");

    // 6 hours, plain text
    logger.info("flexlogs{heartbeat: 'long-batch', interval: '6hr'}");

    // Daily job
    logger.info("flexlogs{heartbeat: 'daily-reports', interval: '1d'}");

    // Weekly job with tags
    logger.info("flexlogs{heartbeat: 'weekly-cleanup', interval: '1w', tags: ['maintenance']}");

    // Fractional hour: 90 minutes
    logger.info("flexlogs{heartbeat: 'ninety-min', interval: '1.5h'}");

    // Complex: combined format + multiple tags
    logger.info("flexlogs{heartbeat: 'importer', interval: '1h30m', tags: ['production', 'imports']}");
  
    
  

Bottom Line

One missed job can wipe out hours of work (or revenue).

A Heartbeat costs you a single log line today and saves a 3 a.m. firefight tomorrow. Switch one on now; the peace of mind is priceless.