Setup options
Nightwatch can ingest Laravel logs in real time. Once configured, logs will appear in the Event Stream inside Nightwatch — fully searchable and correlated with other event types in real time.
There are several ways to configure Nightwatch as part of your logging setup.
Option 1: Add Nightwatch to the Log Stack (Recommended)
If you’re using the default stack driver, you can simply add Nightwatch to the list of channels in your .env file:
LOG_CHANNEL=stack
LOG_STACK=single,nightwatch
Option 2: Send Logs to Nightwatch Only
If you’d prefer to send logs exclusively to Nightwatch, you can set it as your main log channel in your .env file:
If you have enabled sampling and require all logs to be captured then you should not use Nightwatch as your only log channel. Nightwatch will not capture logs from requests, commands, jobs, and scheduled tasks that are not captured due to sampling.
Option 3: Create a Custom Stack
If you’re using a custom log channel (e.g. syslog, etc.) and want to use it in combination with Nightwatch, you can create a custom stack in your .env file:
LOG_CHANNEL=stack
LOG_STACK=syslog,nightwatch
For more information on Logging channels and how to combine them, refer to Laravel’s logging documentation.
Once Nightwatch is set up and running, you may want to explore some advanced options to customize how data is collected from your Laravel application.
Log level configuration
The Nightwatch logger is configured to respect Laravel’s standard logging behavior. It follows these rules in priority order:
NIGHTWATCH_LOG_LEVEL environment variable
- Laravel’s
LOG_LEVEL environment variable
- If neither variable is set, Nightwatch logs all messages of
debug level and higher sent to the nightwatch log channel
Log configuration example
In the following example, Laravel’s single channel would log warning level and higher, while Nightwatch would log error level and higher.
LOG_CHANNEL=stack
LOG_STACK=single,nightwatch
LOG_LEVEL=warning
NIGHTWATCH_LOG_LEVEL=error
Log levels reference
| Log level | Description |
|---|
debug | Detailed debug information |
info | Interesting events |
notice | Uncommon events |
warning | Exceptional occurrences that are not errors |
error | Runtime errors |
critical | Critical conditions |
alert | Action must be taken immediately |
emergency | Urgent alert |