S3 storage for background task logs
Overview
Background task logs are stored locally in ./files/logs/tasks/ by default. To use S3-compatible storage, configure the parameters in the config file.
Required for fault-tolerant configurations
In fault-tolerant environments, background tasks run on each application server node: one node may run N tasks, another node its own set. The Background Tasks tab in the web interface only shows logs from the current node. To view logs from tasks that ran on another node, you must connect to that node directly. With S3 storage, all logs are available from a single store, and you can view them in the web interface without switching between nodes.
Config file
S3 parameters are set in .env.local (or .env in Docker), located at:
- Linux —
/var/www/.env.local - Windows Server —
C:\inetpub\wwwroot\passwork\.env.local - Docker —
/<passwork>/.env
If the file does not exist, create it.
Parameters
| Parameter | Description |
|---|---|
APP_FILES_SOURCE | Storage source: files.storage.local (default) or files.storage.aws (S3). |
S3_REGION | Bucket region. |
S3_BUCKET | Bucket name. |
S3_STORAGE_PREFIX | Path prefix inside the bucket (e.g. passwork-logs). |
S3_STORAGE_KEY | S3 access key. |
S3_STORAGE_SECRET | S3 secret key. |
S3_ENDPOINT | Storage endpoint. Omit for AWS S3. |
S3_USE_PATH_STYLE_ENDPOINT | Path-style addressing: 0 — virtual-hosted style, 1 — path style (use 1 for MinIO). |
Logs are saved at — {S3_STORAGE_PREFIX}logs/tasks/YYYY/MM/DD/task-{taskId}.log
Examples
AWS
- shell
APP_FILES_SOURCE=files.storage.aws
S3_REGION=us-east-1
S3_BUCKET=pwk
S3_STORAGE_PREFIX=passwork-logs
S3_STORAGE_KEY=AKIAIOSFODNN7EXAMPLE
S3_STORAGE_SECRET=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
S3_USE_PATH_STYLE_ENDPOINT=0
MinIO
- shell
APP_FILES_SOURCE=files.storage.aws
S3_REGION=us-east-1
S3_BUCKET=pwk
S3_STORAGE_PREFIX=passwork-logs
S3_ENDPOINT=https://minio.example.com
S3_USE_PATH_STYLE_ENDPOINT=1
S3_STORAGE_KEY=webapp-logs
S3_STORAGE_SECRET=1GV6qaFpMYR11zs0VDEy
DigitalOcean Spaces
- shell
APP_FILES_SOURCE=files.storage.aws
S3_REGION=nyc3
S3_BUCKET=pwk
S3_STORAGE_PREFIX=passwork-logs
S3_ENDPOINT=https://nyc3.digitaloceanspaces.com
S3_USE_PATH_STYLE_ENDPOINT=0
S3_STORAGE_KEY=your-spaces-access-key
S3_STORAGE_SECRET=your-spaces-secret-key
Google Cloud Storage
- shell
APP_FILES_SOURCE=files.storage.aws
S3_REGION=us-east1
S3_BUCKET=pwk
S3_STORAGE_PREFIX=passwork-logs
S3_ENDPOINT=https://storage.googleapis.com
S3_USE_PATH_STYLE_ENDPOINT=0
S3_STORAGE_KEY=your-gcs-hmac-access-id
S3_STORAGE_SECRET=your-gcs-hmac-secret
After changing parameters, restart the PHP-FPM service or Docker container:
- DEB
- RPM
- Docker
- PowerShell
systemctl restart php8.3-fpm
systemctl restart php-fpm
docker restart passwork_php
Restart-Service -Name "W3SVC"