Skip to main content

Environment variables

Log Lens reads a small set of environment variables. Which ones apply depends on how you run it: the standalone app uses LOG_LENS_URL and LOG_LENS_TOKEN; a Laravel install uses LOG_LENS_ENABLED and LOG_LENS_ROUTE_PREFIX.

Variables

VariableDeploymentDefaultPurpose
LOG_LENS_URLStandalone(empty)Canonical base URL. Empty means the base is derived from the request, which is what the dashboard and API use; set it for the command-line AI skills, which have no request to derive from, or to pin a URL behind a proxy. A trailing slash is trimmed.
LOG_LENS_TOKENStandalone(empty)API key. Empty leaves the API unauthenticated (the local-first default). Any non-empty value turns authentication on.
LOG_LENS_ENABLEDLaraveltrueSet to false to unregister the dashboard and API routes entirely - a hard kill-switch, independent of the authorization gate.
LOG_LENS_ROUTE_PREFIXLaravellog-lensURI prefix the dashboard and JSON API are mounted under (for example /log-lens).
LOG_LENS_DB_DRIVERBothsqliteStorage engine: sqlite (default, no other variables needed), pgsql, or mysql. See Database drivers.
LOG_LENS_DB_HOST / _PORT / _NAME / _USER / _PASSWORDBothengine-specificConnection settings for pgsql/mysql; unused for sqlite.

LOG_LENS_TOKEN

When a token is set, every API request must present it as one of:

X-Log-Lens-Token: <token>
Authorization: Bearer <token>

See API key authentication for how requests are checked.

LOG_LENS_ENABLED (Laravel)

Laravel installs gate access through the host app's auth rather than a token, so LOG_LENS_URL and LOG_LENS_TOKEN do not apply there. LOG_LENS_ENABLED=false removes the routes completely:

LOG_LENS_ENABLED=false

.env loading (standalone)

The standalone app reads a .env file next to its config.php. This is a convenience for setups such as Herd where exporting variables into PHP-FPM is awkward.

LOG_LENS_URL=https://logs.example.com
LOG_LENS_TOKEN=your-secret-token

Loading rules:

  • A real environment variable always wins. .env only fills in keys that are not already set in the environment.
  • Blank lines and lines starting with # are ignored.
  • A leading export is stripped.
  • Surrounding single or double quotes around a value are removed.
  • Values are trimmed of surrounding whitespace; an empty value counts as unset.

Because .env only supplies missing keys, you can commit a shared config.php and keep secrets like LOG_LENS_TOKEN out of version control in a local .env.