Logging
Configuring Advanced Logging with R2R
Overview
Users deploying R2R into production settings benefit from robust, persistant logging. R2R supports this via Victorialogs, open source user-friendly database for logs from VictoriaMetrics.
Victorialogs ships by default with the full version of R2R and hosts a UI to view your logs at http://localhost:9428/select/vmui.
Accessing Logs
VictoriaLogs UI
The easiest way to view logs is through the VictoriaLogs UI:
Common Query Examples
Here are some useful queries for finding specific log information:
Troubleshooting Common Issues
No Logs Showing Up
If you don’t see any logs:
- Increase the time range - logs might be outside your current time window
- Check if Fluent Bit is running:
docker ps | grep fluent-bit
- Check VictoriaLogs is running:
docker ps | grep victoria-logs
- Verify your R2R container is properly configured for logging
Understanding Error Logs
When you see an error in the logs, it typically follows this pattern:
- Error message with timestamp
- A traceback showing the sequence of function calls
- The specific error and its cause
Look for the actual error message at the bottom of a traceback to understand the root cause.
Advanced Configuration
Customizing Fluent Bit
If you need to customize how logs are collected and processed, you can modify the Fluent Bit configuration:
- Create/edit the
fluent-bit.conf
file in your./fluent-bit
directory - Restart the Fluent Bit container:
docker restart docker-fluent-bit-1
Setting Up Grafana for Log Visualization
For more advanced visualization, you can connect Grafana to VictoriaLogs:
-
Access Grafana at http://localhost:3001
-
Add a new VictoriaLogs data source:
- Go to Configuration > Data Sources > Add data source
- Select “VictoriaMetrics Logs”
- Set URL to http://victoria-logs:9428
- Save and test the connection
-
Create a new dashboard with a Logs panel
-
Configure the panel to query logs using the same query syntax as in the VictoriaLogs UI
Retention Policy
By default, logs are retained for 60 days as configured in the Docker Compose file:
To change the retention period, modify the -retentionPeriod
parameter and restart the container.
Log Format
Each log entry contains:
_time
: Timestamp of the logcontainer_name
: Source containerlog
: The actual log message- Additional metadata
When searching logs, you’ll typically want to search for content in the log
field.