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.| Tool | Purpose | Hosting | Target environment |
|---|---|---|---|
| Telescope | Debugging and query investigation during development | Self-hosted (inside your Laravel app) | Local dev |
| Pulse | Aggregation and visualization of performance metrics | Self-hosted (inside your Laravel app) | Production / staging |
| Nightwatch | Real-time monitoring of production apps | Laravel-hosted SaaS | Production |
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
--dev flag is not used. Nightwatch is designed for production.
3. Configure the token
Add the token to.env.
4. Start the agent
5. Disable in the test environment
We recommend disabling Nightwatch while tests run.phpunit.xml.
Settings that make the free plan practical
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.
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).Other filtering options
You can also disable cache events, mail, notifications, and outgoing requests as needed.Free plan recommended settings summary
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.Log collection
Integrates with Laravel’s logging system (Log::error(), etc.) to send structured logs to Nightwatch.
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
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.1andNIGHTWATCH_IGNORE_QUERIES=trueare effectively required in practice - Telescope (dev), Pulse (aggregation), and Nightwatch (monitoring) have different roles and can be used together
Laravel Telescope hands-on techniques
Use Telescope for debugging in local development.