This guide describes how to configure Grafana Alloy using Docker to collect logs from Laravel applications and NGINX, and forward them to a Grafana Loki instance.
alloy-setup/
├── config/
│ └── config.alloy # Alloy configuration
├── docker-compose.yml # Docker Compose file
└── README.md # This documentation
- Application logs (e.g.,
storage/logs/lumen.logorstorage/logs/laravel.log) and Web Server logs (/var/log/nginx/access.logor/var/log/httpd/access.log) are tailed. - Each log type is parsed using custom regex.
- Logs are enriched with labels and pushed to Loki for search and visualization in Grafana.
Make sure your project contains:
config.alloydocker-compose.yml- This
README.md
In config.alloy, I included example configuration to read Laravel and NGINX logs.
You can customize this configuration to suit your application. For further information, please visit monitor metrics and logs
Mount your local log folders in docker-compose.yml:
volumes:
- /path/to/project/storage/logs:/var/log/app # application log folder
- /path/to/web/server/logs/:/var/log/web-server # web server log folder (host)Adjust the paths as needed depending on your environment.
docker-compose up -d --build