Skip to content

agungputrap/alloy-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Grafana Alloy Log Collector Setup

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.


Directory Structure

alloy-setup/
├── config/  
│   └── config.alloy      # Alloy configuration
├── docker-compose.yml    # Docker Compose file
└── README.md             # This documentation

How It Works

  • Application logs (e.g., storage/logs/lumen.log or storage/logs/laravel.log) and Web Server logs (/var/log/nginx/access.log or /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.

Setup Instructions

1. Clone/Copy Files

Make sure your project contains:

  • config.alloy
  • docker-compose.yml
  • This README.md

2. Customize config.alloy

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

3. Configure Docker Volumes

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.

4. Run Alloy

docker-compose up -d --build

About

This is a replica of the Alloy setup that I’m working on at the office.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors