# Blockscout Logs Review **Date**: December 23, 2025 **Container**: VMID 5000 on pve2 (192.168.11.140) --- ## Log Review Summary This document contains a comprehensive review of all Blockscout-related logs including: - Docker container logs (Blockscout and PostgreSQL) - Nginx access and error logs - System status information - Error analysis - Database status --- ## Container Status ### Blockscout Container ```bash # Check container status docker ps -a | grep blockscout # View recent logs docker logs --tail 100 blockscout # Follow logs in real-time docker logs -f blockscout ``` ### PostgreSQL Container ```bash # Check PostgreSQL status docker ps | grep postgres # View PostgreSQL logs docker logs --tail 50 blockscout-postgres ``` --- ## Nginx Logs ### Error Log ```bash tail -50 /var/log/nginx/blockscout-error.log # or tail -50 /var/log/nginx/error.log ``` ### Access Log ```bash tail -50 /var/log/nginx/blockscout-access.log # or tail -50 /var/log/nginx/access.log ``` --- ## Common Issues and Solutions ### Issue: Container Restarting **Symptoms**: `docker ps` shows "Restarting" status **Check**: ```bash docker logs blockscout | tail -50 docker inspect blockscout | grep -A 10 RestartCount ``` **Common Causes**: 1. Database connection issues 2. Missing environment variables 3. Port conflicts 4. Memory limits ### Issue: HTTP 502 Bad Gateway **Symptoms**: Nginx returns 502, Blockscout container is running **Check**: ```bash # Check if Blockscout is responding curl http://localhost:4000/api/v2/status # Check Nginx error log tail -20 /var/log/nginx/error.log # Check Blockscout logs for startup errors docker logs blockscout | grep -i error ``` **Common Causes**: 1. Blockscout still initializing 2. Database migrations incomplete 3. Application crash 4. Network connectivity issues ### Issue: Database Migration Errors **Symptoms**: Logs show "relation does not exist" or migration errors **Check**: ```bash # Check database tables docker exec blockscout-postgres psql -U blockscout -d blockscout -c '\dt' # Check migration status in logs docker logs blockscout | grep -i migration ``` **Solution**: Wait for auto-migration to complete, or manually run migrations --- ## Log Analysis Commands ### Filter by Severity ```bash # Errors only docker logs blockscout 2>&1 | grep -i error # Warnings docker logs blockscout 2>&1 | grep -i warn # Info messages docker logs blockscout 2>&1 | grep -i info ``` ### Filter by Component ```bash # Database/Repo issues docker logs blockscout 2>&1 | grep -i -E "(database|postgres|repo|ecto)" # Phoenix/Endpoint docker logs blockscout 2>&1 | grep -i -E "(phoenix|endpoint|listening)" # Indexer docker logs blockscout 2>&1 | grep -i indexer # API requests docker logs blockscout 2>&1 | grep -i api ``` ### Timeline Analysis ```bash # Recent activity (last hour) docker logs --since 1h blockscout # Specific time range docker logs --since 2025-12-23T20:00:00 --until 2025-12-23T21:00:00 blockscout ``` --- ## Monitoring Commands ### Real-time Monitoring ```bash # Follow all container logs docker-compose -f /opt/blockscout/docker-compose.yml logs -f # Follow specific service docker logs -f blockscout docker logs -f blockscout-postgres # Nginx access in real-time tail -f /var/log/nginx/blockscout-access.log # Nginx errors in real-time tail -f /var/log/nginx/blockscout-error.log ``` ### Health Checks ```bash # Blockscout API curl http://localhost:4000/api/v2/status # Nginx HTTPS curl -k https://localhost/health # External curl https://explorer.d-bis.org/health ``` --- ## Log Locations | Component | Log Location | |-----------|-------------| | Blockscout Container | `docker logs blockscout` | | PostgreSQL Container | `docker logs blockscout-postgres` | | Nginx Error | `/var/log/nginx/blockscout-error.log` or `/var/log/nginx/error.log` | | Nginx Access | `/var/log/nginx/blockscout-access.log` or `/var/log/nginx/access.log` | | Systemd Nginx | `journalctl -u nginx` | | Docker Compose | `docker-compose -f /opt/blockscout/docker-compose.yml logs` | --- ## Quick Diagnostics ### Full System Check ```bash # Container status docker ps -a | grep -E "(blockscout|postgres)" # Docker compose status cd /opt/blockscout && docker-compose ps # Nginx status systemctl status nginx # Recent errors docker logs blockscout 2>&1 | tail -50 | grep -i error # Database connection docker exec blockscout-postgres pg_isready -U blockscout ``` --- ## Notes - Logs are rotated automatically - Container logs persist until container is removed - Use `docker logs --since` for time-based queries - Nginx logs may need manual rotation if volume is high - Consider log aggregation for production environments --- ## See Also - `BLOCKSCOUT_SSL_COMPLETE_STATUS.md` - Overall status - `BLOCKSCOUT_CONFIGURATION_GUIDE.md` - Configuration details - `BLOCKSCOUT_FIXED_SUCCESS.md` - Previous fixes applied