This repository contains the demo for the talk "Mastering Observability with Open Source Tools" by Luca Raveri.
In this demo, we'll explore how to create powerful log visualizations using Grafana Alloy, Loki, and Grafana to gain insights into application behavior, performance, and issues.
- How to set up a complete observability stack
- Configure Grafana Alloy to collect logs from files
- Stream logs to Loki for aggregation and indexing
- Create comprehensive dashboards in Grafana
- Query and analyze logs with LogQL
Node.js App → Log File → Grafana Alloy → Loki → Grafana
- Node.js Application: Generates realistic API traffic and logs to file
- Grafana Alloy: Reads logs from file and forwards them to Loki
- Loki: Aggregates and indexes logs
- Grafana: Visualizes and analyzes logs with dashboards
- Docker installed
# Clone the repository
git clone <repository-url>
cd grafana-demo
# (Optional) Configure alert email
# Create .env file with your email for receiving alerts
echo "[email protected]" > .env# Start all services
docker-compose up -dThis command will:
- Build the Node.js application
- Start Loki, Alloy, and Grafana
- Automatically configure Loki as datasource in Grafana
- Import all dashboards into Grafana
- Import alert rules and configure email notifications
- Open your browser at: http://localhost:3000
- Login with:
- Username:
admin - Password:
admin
- Username:
In Grafana:
- Go to Explore (compass icon in the sidebar)
- Select Loki as datasource (already configured)
- Try these LogQL queries:
# All logs
{job="grafana-demo"}
# Only errors
{job="grafana-demo"} | json | level="error"
# HTTP requests
{job="grafana-demo"} |= "HTTP request"
# Slow queries (>100ms)
{job="grafana-demo"} | json | queryTime > 100
# Error rate per minute
sum(rate({job="grafana-demo"} | json | level="error" [1m]))
All dashboards are automatically imported into the "Grafana Demo" folder:
- Click on Dashboards (squares icon in the sidebar)
- Open the "Grafana Demo" folder
- Available dashboards:
- API Logs - Real-time log streaming with filtering
- Fatal Errors - Time series visualization of critical errors
- HTTP Responses - All HTTP responses with performance metrics
- Query Executed - Database query monitoring
- Response Codes - API health and error patterns
- EmailService - Email Sent - Email service logs (sent/errored)
- EmailService Logs - All EmailService activity
Alert rules are automatically imported and configured:
- Go to Alerting → Alert rules (bell icon in the sidebar)
- You'll find the rules in the "Grafana Demo Alerts" folder:
- FATAL ERROR - Triggers when application crashes
- 500 Error Spike - Triggers when too many 500 errors occur
Email notifications are automatically configured to: ${ALERT_EMAIL} (from your .env file)
To test alerts, the application generates occasional errors and crashes.
# Stop but keep data
docker-compose stop
# Stop and remove containers (keeps volumes)
docker-compose down
# Remove everything including data (⚠️ deletes all logs and dashboard updates!)
docker-compose down -v- Grafana UI: http://localhost:3000
- Loki API: http://localhost:3100
- Alloy UI: http://localhost:12345
The presentation slides for this demo are available in the repository:
- Slides:
slide/grafana-talk.pdf
These slides accompany the live demonstration and provide additional context about observability best practices, Grafana setup, and Loki query examples.
Speaker: Luca Raveri
Talk: "Mastering Observability with Open Source Tools"
This project is licensed under the MIT License - see the LICENSE file for details.
🌟 Star this repo if you find it useful!