Skip to main content

What is Laravel Nightwatch?

Laravel Nightwatch is a hosted SaaS platform for continuously monitoring Laravel applications in production. It collects and visualizes telemetry from across your app—HTTP requests, SQL queries, exceptions, queued jobs, logs, and scheduled tasks—in real time.
Nightwatch is a paid service (monthly subscription). A free plan is available, but the number of events you can collect is capped. To use the free plan practically, the sampling and filtering settings described below are essential.

How it differs from Telescope and Pulse

Nightwatch’s purpose differs from other monitoring and debugging tools in the Laravel ecosystem. Here’s how they line up.
ToolPurposeHostingTarget environment
TelescopeDebugging and query investigation during developmentSelf-hosted (inside your Laravel app)Local dev
PulseAggregation and visualization of performance metricsSelf-hosted (inside your Laravel app)Production / staging
NightwatchReal-time monitoring of production appsLaravel-hosted SaaSProduction
It collects nearly the same information as Telescope, but Nightwatch runs a resident agent process that ships data to the cloud. That means historical data is accessible even if the server goes down, and multiple servers or applications can be managed together.

Architecture

Nightwatch sits an agent process between your Laravel app and the Nightwatch cloud. The agent listens locally (127.0.0.1:2407), receives events from the Laravel app, and forwards them to the cloud. Because of this, the agent process must be running at all times.

Installation and initial setup

1. Create your account and application

Create an account on nightwatch.laravel.com and register your organization and application. After registering an application, an environment token is issued.

2. Install the package

composer require laravel/nightwatch
Unlike Telescope, the --dev flag is not used. Nightwatch is designed for production.

3. Configure the token

Add the token to .env.
NIGHTWATCH_TOKEN=your-api-key

4. Start the agent

php artisan nightwatch:agent
The agent must run continuously in the background. Dedicated guides are available for Laravel Cloud, Laravel Forge, and Laravel Vapor. On Forge, using the official integration configures this automatically. Check the agent’s status:
php artisan nightwatch:status

5. Disable in the test environment

We recommend disabling Nightwatch while tests run.
# .env
NIGHTWATCH_ENABLED=false
It can also be set in phpunit.xml.
<php>
    <env name="APP_ENV" value="testing"/>
    <env name="NIGHTWATCH_ENABLED" value="false"/>
</php>

Settings that make the free plan practical

The free plan has a monthly event cap. With the defaults (sampling rate 100%, collect everything), a high-traffic app hits the limit quickly. Apply the settings below.

Lower the sampling rate

NIGHTWATCH_REQUEST_SAMPLE_RATE defaults to 1.0 (collect every request). We recommend cutting it to about 0.1 (10%) on the free plan.
# .env
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1
Example that keeps exceptions and commands fully sampled:
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1    # Requests: only 10%
NIGHTWATCH_EXCEPTION_SAMPLE_RATE=1.0  # Exceptions: all (default)
NIGHTWATCH_COMMAND_SAMPLE_RATE=1.0    # Commands: all (default)

Disable query collection

Database queries make up a large share of events. Disabling query collection on the free plan preserves room for more important events (exceptions, requests, jobs).
# .env
NIGHTWATCH_IGNORE_QUERIES=true

Other filtering options

You can also disable cache events, mail, notifications, and outgoing requests as needed.
NIGHTWATCH_IGNORE_CACHE_EVENTS=true
NIGHTWATCH_IGNORE_MAIL=true
NIGHTWATCH_IGNORE_NOTIFICATIONS=true
NIGHTWATCH_IGNORE_OUTGOING_REQUESTS=true
# .env (recommended for the free plan)
NIGHTWATCH_TOKEN=your-api-key
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1
NIGHTWATCH_IGNORE_QUERIES=true
Just these three lines make practical monitoring feasible on the free plan.

Main features

Request monitoring

Collects response time, status code, and route info for each HTTP request. Identify unusually slow endpoints and pinpoint performance bottlenecks.

Exception tracking

Captures unhandled exceptions in production in real time. Stack traces and source snippets are recorded automatically, making root cause analysis easier.
# Capture exception source code (default: enabled)
NIGHTWATCH_CAPTURE_EXCEPTION_SOURCE_CODE=true

Log collection

Integrates with Laravel’s logging system (Log::error(), etc.) to send structured logs to Nightwatch.
# Minimum log level to collect (default: debug)
NIGHTWATCH_LOG_LEVEL=error

Jobs and scheduled task monitoring

Track execution history, success/failure status, and duration for queued jobs and scheduled tasks. Quickly identify issues in batch processing.

Deployment tracking

Correlates release changes to issues. You can visually investigate “exceptions started spiking after this deploy.”

Alerts and notifications

Use Slack integration or webhooks to get notified instantly on exception spikes or performance regressions.

When to use Telescope vs. Nightwatch

  • Local development → Telescope
  • Aggregated production dashboard → Pulse
  • Detailed production traces and alerts → Nightwatch
The three aren’t mutually exclusive—running Pulse and Nightwatch alongside each other is fine.

Summary

Laravel Nightwatch is a powerful SaaS tool that significantly boosts visibility into production Laravel apps. Keep the following in mind when introducing it:
  • The agent process must run continuously
  • On the free plan, NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1 and NIGHTWATCH_IGNORE_QUERIES=true are effectively required in practice
  • Telescope (dev), Pulse (aggregation), and Nightwatch (monitoring) have different roles and can be used together
For detailed configuration, see the official docs and the environment variables reference.

Laravel Telescope hands-on techniques

Use Telescope for debugging in local development.
Last modified on July 13, 2026