Ingest logs from a local directory
Point Log Lens at a folder of .log files on the same machine and it will discover, mirror, and index them. Use this when your logs live on local disk rather than a remote host.
1. Create the connector
Send a POST with a local connector. Only directory is required.
| Field | Required | Notes |
|---|---|---|
name | yes | 1-100 characters, unique |
type | yes | local |
config.directory | yes | An existing, readable directory (stored as its resolved absolute path) |
config.recursive | no | Scan subdirectories. Defaults to true |
module_id | no | Attach ingested logs to a module |
enabled | no | Defaults to true |
POST ?api=connectors
{
"name": "App logs",
"type": "local",
"config": { "directory": "/var/www/app/storage/logs", "recursive": true }
}
Discovery keeps files whose names match .log (including rotated names like laravel.log.1). See Which files count as logs.
2. Test the connection
POST ?api=connector-test
{ "id": 12 }
A successful test reports how many log files were discovered. If the directory is missing or unreadable, creation and testing fail with a clear error.
3. Preview before syncing
A preview is a dry run: it lists each file with a planned action (new, append, unchanged, rotation, rename, reconcile, already_ingested, or index_local), the bytes to fetch, and a snapshot hash of the discovered file set.
POST ?api=connector-preview
{ "id": 12 }
Pass that snapshot back into the sync to guarantee the files have not changed since you reviewed them. See Sync preview and snapshots.
4. Sync
POST ?api=connector-sync
{ "id": 12, "snapshot": "<from preview>" }
Sync queues a detached worker that mirrors new bytes into a canonical copy and indexes events. The request returns 202 with run ids; read ?api=connector-runs for live progress and the final result. Only enabled connectors sync, and a connector cannot sync twice at once. Omit id to sync every enabled connector.
You can also sync from the command line:
php artisan log-lens:sync --connector=12