Skip to main content ホーム クリエイター coollabsio coolify configure-nightwatch
configure-nightwatch Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads.
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/coollabsio/coolify --skill configure-nightwatchコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".
Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing Horizon (horizon:install, Sail setup), configuring config/horizon.php (supervisor blocks, queue assignments, balancing strategies, minProcesses/maxProcesses), fixing the dashboard (authorization via Gate::define viewHorizon, blank metrics, horizon:snapshot scheduling), and troubleshooting production issues (worker crashes, timeout chain ordering, LongWaitDetected notifications, waits config). Also covers job tagging and silencing. Do not use for generic Laravel queues without Horizon, SQS or database drivers, standalone Redis setup, Linux supervisord, Telescope, or job batching.
name configure-nightwatch description Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads. license MIT metadata {"author":"laravel"}
Nightwatch Configuration Guide
This skill helps configure Laravel Nightwatch data collection to balance observability, performance, and privacy. Covers sampling strategies, filtering rules, and redaction methods across all event types.
Documentation Reference
The Nightwatch Documentation is the definitive and up-to-date source of information for all Nightwatch configuration options. This skill provides practical guidance and common patterns, but always consult the official documentation as the primary source of truth for specific details, environment variables, and API behavior. The documentation includes comprehensive coverage of:
Filtering and Configuration - Core concepts for sampling, filtering, and redaction
Individual event type pages with specific configuration options:
Requests - Request sampling, header handling, payload capture
Commands - Command sampling and redaction
Queries - Query filtering and redaction
Cache - Cache event filtering by key or patternJobs - Job filtering and sampling decouplingMail - Mail event filteringreference.md - Quick lookup table by event type, production presets, and verification checklist
Data Collection Flow Nightwatch processes events through three stages:
Sampling - Controls which entry points are captured (requests, commands, scheduled tasks)
Filtering - Excludes specific events after sampling (queries, cache, mail, etc.)
Redaction - Modifies captured data to remove/obfuscate sensitive information
Request/Command/Scheduled Task
|
v
[Sampling?] ----NO----> Drop entire trace
| YES
v
Events generated
|
v
[Filtering?] ----YES---> Drop specific event
| NO
v
[Redaction] ----------> Store modified data
Sampling Configuration Sampling determines which entry points (requests, commands, scheduled tasks) trigger full trace collection. When an entry point is sampled, all related events are captured.
Global Sample Rates Configure via environment variables:
NIGHTWATCH_REQUEST_SAMPLE_RATE=0.1
NIGHTWATCH_COMMAND_SAMPLE_RATE=1.0
NIGHTWATCH_EXCEPTION_SAMPLE_RATE=1.0
Recommendation : Start with 0.1 (10%) for requests in production, adjust based on volume and needs.
Route-Based Sampling Apply different rates to specific routes using the Sample middleware:
use Illuminate \Support \Facades \Route ;
use Laravel \Nightwatch \Http \Middleware \Sample ;
Route ::middleware (Sample ::rate (1.0 ))->prefix ('admin' )->group (function () {
});
Route ::middleware (Sample ::rate (0.05 ))->prefix ('api' )->group (function () {
});
Route ::post ('/checkout' , [CheckoutController ::class , 'process' ])
->middleware (Sample ::always ());
Route ::get ('/health' , [HealthController ::class , 'check' ])
->middleware (Sample ::never ());
Unmatched Route Sampling Handle 404/bot traffic with reduced sampling:
Route ::fallback (fn () => abort (404 ))
->middleware (Sample ::rate (0.01 ));
Dynamic Sampling Sample based on runtime conditions (user role, request attributes):
use Closure ;
use Illuminate \Http \Request ;
use Laravel \Nightwatch \Facades \Nightwatch ;
class SampleAdminRequests
{
public function handle (Request $request , Closure $next )
{
if ($request ->user ()?->isAdmin ()) {
Nightwatch ::sample ();
}
return $next ($request );
}
}
Command Sampling Exclude specific commands from sampling:
use Illuminate \Console \Events \CommandStarting ;
use Illuminate \Support \Facades \Event ;
use Laravel \Nightwatch \Facades \Nightwatch ;
public function boot ( ): void
{
Event ::listen (function (CommandStarting $event ) {
if (in_array ($event ->command, ['schedule:finish' , 'horizon:snapshot' ])) {
Nightwatch ::dontSample ();
}
});
}
Vendor Commands Nightwatch automatically ignores framework/internal commands. Opt-in to capture them:
Nightwatch ::captureDefaultVendorCommands ();
Filtering Configuration Filtering excludes specific events from collection after sampling. Use filtering to reduce noise and quota usage.
Database Queries Filter all queries (disable query collection):
NIGHTWATCH_IGNORE_QUERIES=true
Filter specific queries by SQL pattern:
use Laravel \Nightwatch \Facades \Nightwatch ;
use Laravel \Nightwatch \Records \Query ;
public function boot ( ): void
{
Nightwatch ::rejectQueries (function (Query $query ) {
return str_contains ($query ->sql, 'into "jobs"' );
});
Nightwatch ::rejectQueries (function (Query $query ) {
return str_contains ($query ->sql, 'from `cache`' )
|| str_contains ($query ->sql, 'into `cache`' );
});
}
Cache Events NIGHTWATCH_IGNORE_CACHE_EVENTS=true
Filter by cache key patterns :
Nightwatch ::rejectCacheKeys ([
'my-app:users' , // Exact match
'/^my-app:posts:/' , // Regex : starts with my-app :posts :
'/^[a-zA-Z0-9]{40}$/' , // Regex : session IDs
]);
use Laravel \Nightwatch \Records \CacheEvent ;
Nightwatch ::rejectCacheEvents (function (CacheEvent $cacheEvent ) {
return str_starts_with ($cacheEvent ->key, 'temp:' );
});
Mail Events NIGHTWATCH_IGNORE_MAIL=true
use Laravel \Nightwatch \Records \Mail ;
Nightwatch ::rejectMail (function (Mail $mail ) {
return str_contains ($mail ->subject, 'Newsletter' );
});
Notification Events Filter all notifications :
NIGHTWATCH_IGNORE_NOTIFICATIONS=true
use Laravel \Nightwatch \Records \Notification ;
Nightwatch ::rejectNotifications (function (Notification $notification ) {
return $notification ->channel === 'database' ;
});
Outgoing HTTP Requests Filter all outgoing requests :
NIGHTWATCH_IGNORE_OUTGOING_REQUESTS=true
use Laravel \Nightwatch \Records \OutgoingRequest ;
Nightwatch ::rejectOutgoingRequests (function (OutgoingRequest $request ) {
return str_contains ($request ->url, 'analytics.example.com' );
});
Queued Jobs use Laravel \Nightwatch \Records \QueuedJob ;
Nightwatch ::rejectQueuedJobs (function (QueuedJob $job ) {
return $job ->name === 'App\Jobs\LowPriorityJob' ;
});
Decoupling Job Sampling Sample jobs independently from parent contexts:
use Illuminate \Support \Facades \Queue ;
public function boot ( ): void
{
Queue ::before (fn () => Nightwatch ::sample (rate : 0.5 ));
}
Redaction Configuration Redaction modifies captured data to remove or obfuscate sensitive information. Unlike filtering, redaction keeps the event but sanitizes its content.
Request Redaction Redact sensitive headers (automatically redacts: Authorization, Cookie, X-XSRF-TOKEN):
NIGHTWATCH_REDACT_HEADERS=Authorization,Cookie,Proxy-Authorization,X-API-Key
Redact request payloads (disabled by default):
NIGHTWATCH_CAPTURE_REQUEST_PAYLOAD=true
NIGHTWATCH_REDACT_PAYLOAD_FIELDS=password,password_confirmation,ssn,credit_card
use Laravel \Nightwatch \Facades \Nightwatch ;
use Laravel \Nightwatch \Records \Request ;
Nightwatch ::redactRequests (function (Request $request ) {
$request ->url = str_replace ('secret' , '***' , $request ->url);
$request ->ip = preg_replace ('/\d+$/' , '***' , $request ->ip);
});
Query Redaction use Laravel \Nightwatch \Records \Query ;
Nightwatch ::redactQueries (function (Query $query ) {
$query ->sql = str_replace ('secret_token' , '***' , $query ->sql);
});
Cache Redaction use Laravel \Nightwatch \Records \CacheEvent ;
Nightwatch ::redactCacheEvents (function (CacheEvent $cacheEvent ) {
$cacheEvent ->key = str_replace ('user:' , 'user:***:' , $cacheEvent ->key);
});
Command Redaction use Laravel \Nightwatch \Records \Command ;
Nightwatch ::redactCommands (function (Command $command ) {
$command ->command = preg_replace ('/--password=\S+/' , '--password=***' , $command ->command);
});
Exception Redaction use Laravel \Nightwatch \Records \Exception ;
Nightwatch ::redactExceptions (function (Exception $exception ) {
$exception ->message = str_replace ('secret' , '***' , $exception ->message);
});
Mail Redaction use Laravel \Nightwatch \Records \Mail ;
Nightwatch ::redactMail (function (Mail $mail ) {
$mail ->subject = str_replace ('Invoice #' , 'Invoice ***' , $mail ->subject);
});
Outgoing Request Redaction use Laravel \Nightwatch \Records \OutgoingRequest ;
Nightwatch ::redactOutgoingRequests (function (OutgoingRequest $outgoingRequest ) {
$outgoingRequest ->url = preg_replace ('/api_key=\w+/' , 'api_key=***' , $outgoingRequest ->url);
});