> ## Documentation Index
> Fetch the complete documentation index at: https://nightwatch.laravel.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> A complete reference of all environment variables available in Laravel Nightwatch.

export const EnvVar = props => {
  const slug = props.name.toLowerCase().replace(/_/g, '-');
  return <div className="field pt-2.5 pb-5 my-2.5 border-gray-50 dark:border-gray-800/50 border-b scroll-mt-20" id={slug}>
      <div className="flex items-baseline gap-3 flex-wrap">
        <a href={'#' + slug} className="border-none">
          <code className="text-sm font-semibold !text-blue-500 p-0 !bg-transparent">{props.name}</code>
        </a>
        {props.default && <div className="font-mono text-xs px-2 py-0.5 rounded-md bg-gray-100/50 dark:bg-white/5 text-gray-600 dark:text-gray-200 font-medium break-all">
            <span className="text-gray-400 dark:text-gray-500">default: </span>
            <span>{props.default}</span>
          </div>}
        {props.required && <span className="font-mono text-xs px-2 py-0.5 rounded-md bg-red-100/50 dark:bg-red-400/10 text-red-600 dark:text-red-300 font-medium whitespace-nowrap">required</span>}
      </div>
      <div className="mt-4 prose-sm prose-gray dark:prose-invert [&_.prose>p:first-child]:mt-0 [&_.prose>p:last-child]:mb-0">
        {props.children}
      </div>
    </div>;
};

This page provides a comprehensive reference of all environment variables available in Nightwatch. These variables can be set in your application's `.env` file or in the environment where your application runs.

## Core

<EnvVar name="NIGHTWATCH_TOKEN" required>
  Your environment's API token, used to authenticate the Nightwatch agent. Both the Laravel application and the [Nightwatch agent](/start-guide) must be configured with a valid and matching token.
</EnvVar>

<EnvVar name="NIGHTWATCH_ENABLED" default="true">
  Controls whether Nightwatch is active. Set to `false` to disable monitoring, for example during local development or test suite runs.
</EnvVar>

<EnvVar name="NIGHTWATCH_DEPLOY" default={<span className="opacity-60">auto-detected</span>}>
  An optional identifier for the current deployment or release version. This is automatically detected when using <a href="https://cloud.laravel.com">Laravel Cloud</a>, <a href="https://forge.laravel.com">Laravel Forge</a>, and <a href="https://vapor.laravel.com">Laravel Vapor</a>.
</EnvVar>

<EnvVar name="NIGHTWATCH_SERVER" default="gethostname()">
  Sets the server name or instance identifier used when reporting events. Defaults to the system hostname.
</EnvVar>

## Sampling

Sampling controls the rate at which entry points are collected. For more detail, see the [Filtering](/filtering#sampling) documentation.

<EnvVar name="NIGHTWATCH_REQUEST_SAMPLE_RATE" default="1.0">
  The percentage of HTTP requests to sample, from `0.0` (none) to `1.0` (all). When a request is sampled in, Nightwatch captures the full execution context. See [Requests: Sampling](/requests#sampling).
</EnvVar>

<EnvVar name="NIGHTWATCH_COMMAND_SAMPLE_RATE" default="1.0">
  The percentage of Artisan commands to sample, from `0.0` to `1.0`. When a command is sampled in, Nightwatch captures the full execution context. See [Commands: Sampling](/commands#sampling).
</EnvVar>

<EnvVar name="NIGHTWATCH_SCHEDULED_TASK_SAMPLE_RATE" default="1.0">
  The percentage of scheduled tasks to sample, from `0.0` to `1.0`. Takes precedence over `NIGHTWATCH_COMMAND_SAMPLE_RATE` when scheduling Artisan commands. See [Scheduled Tasks: Sampling](/scheduled-tasks#sampling).
</EnvVar>

<EnvVar name="NIGHTWATCH_EXCEPTION_SAMPLE_RATE" default="1.0">
  The percentage of exceptions to sample, from `0.0` to `1.0`. When set to `1.0` (default), Nightwatch captures the full execution context for any execution that encounters an exception, regardless of whether it was otherwise sampled. Set to `0` to only capture exceptions from sampled executions. See [Exceptions: Sampling](/exceptions#sampling).
</EnvVar>

## Data Capture

<EnvVar name="NIGHTWATCH_CAPTURE_EXCEPTION_SOURCE_CODE" default="true">
  Controls whether Nightwatch captures source code snippets for exception stack traces. Set to `false` to disable. See [Exceptions: Source Code Capture](/exceptions#source-code-capture).
</EnvVar>

<EnvVar name="NIGHTWATCH_CAPTURE_REQUEST_PAYLOAD" default="false">
  Enables capture of the request payload for requests that resulted in exceptions. Disabled by default due to the sensitive nature of payload data. See [Requests: Capture Request Payloads](/requests#capture-request-payloads).
</EnvVar>

## Redaction

<EnvVar name="NIGHTWATCH_REDACT_HEADERS" default={'"Authorization,Cookie,Proxy-Authorization,X-XSRF-TOKEN"'}>
  A comma-separated list of request headers to redact. See [Requests: Capture Request Headers](/requests#capture-request-headers).
</EnvVar>

<EnvVar name="NIGHTWATCH_REDACT_PAYLOAD_FIELDS" default={'"_token,password,password_confirmation"'}>
  A comma-separated list of request payload fields to redact. See [Requests: Capture Request Payloads](/requests#capture-request-payloads).
</EnvVar>

## Filtering

Filtering allows you to exclude specific event types from collection. For more detail, see the [Filtering](/filtering#filtering) documentation.

<EnvVar name="NIGHTWATCH_IGNORE_QUERIES" default="false">
  Excludes all database queries from collection when set to `true`. See [Queries: Filtering](/queries#filtering).
</EnvVar>

<EnvVar name="NIGHTWATCH_IGNORE_CACHE_EVENTS" default="false">
  Excludes all cache events from collection when set to `true`. See [Cache: Filtering](/cache#filtering).
</EnvVar>

<EnvVar name="NIGHTWATCH_IGNORE_MAIL" default="false">
  Excludes all mail events from collection when set to `true`. See [Mail: Filtering](/mail#filtering).
</EnvVar>

<EnvVar name="NIGHTWATCH_IGNORE_NOTIFICATIONS" default="false">
  Excludes all notification events from collection when set to `true`. See [Notifications: Filtering](/notifications#filtering).
</EnvVar>

<EnvVar name="NIGHTWATCH_IGNORE_OUTGOING_REQUESTS" default="false">
  Excludes all outgoing HTTP requests from collection when set to `true`. See [Outgoing Requests: Filtering](/outgoing-requests#filtering).
</EnvVar>

<EnvVar name="NIGHTWATCH_LOG_LEVEL" default={<>env('LOG_LEVEL') <span className="opacity-60">or</span> "debug"</>}>
  The minimum log level to send to Nightwatch. Takes precedence over Laravel's `LOG_LEVEL` variable. See [Logs: Filtering](/logs#filtering).
</EnvVar>

## Ingest

These variables control how the Laravel application sends data to the local Nightwatch agent.

<EnvVar name="NIGHTWATCH_INGEST_URI" default={'"127.0.0.1:2407"'}>
  The host and port of the local Nightwatch agent. Must be updated when running multiple agents on the same server or when the agent runs as a separate service (e.g., in Docker). See [Start Guide](/start-guide).
</EnvVar>

<EnvVar name="NIGHTWATCH_INGEST_TIMEOUT" default="0.5">
  Timeout in seconds for each send operation to the agent.
</EnvVar>

<EnvVar name="NIGHTWATCH_INGEST_CONNECTION_TIMEOUT" default="0.5">
  Timeout in seconds for establishing a connection with the agent.
</EnvVar>

<EnvVar name="NIGHTWATCH_INGEST_EVENT_BUFFER" default="500">
  The maximum number of events to buffer before flushing to the agent.
</EnvVar>

## Agent

These variables are consumed by the standalone Nightwatch agent process, typically set in the agent's environment or `.env` file.

<EnvVar name="NIGHTWATCH_TOKEN" required>
  The authentication token for the agent. Must match the token configured in your Laravel application.
</EnvVar>

<EnvVar name="NIGHTWATCH_INGEST_URI" default={'"127.0.0.1:2407"'}>
  The address and port the agent listens on for incoming data from the application. In Docker, this defaults to `0.0.0.0:2407` to bind to all interfaces.
</EnvVar>

<EnvVar name="NIGHTWATCH_AGENT_LOG_LEVEL" default={'"info"'}>
  Controls the agent's log verbosity. Accepted values: `critical` (silent), `error` (errors only), `verbose` (debug output).
</EnvVar>
