This project provides a centralized log monitoring solution that collects logs from multiple Linux machines (clients) to a central RHEL server, then visualizes them in a real-time Next.js web dashboard. The system consists of three main components:
- Log Server (RHEL): Receives and stores logs from multiple clients
- Clients (Ubuntu, Rocky Linux, Kali): Send system logs to the server
- Web Dashboard (Next.js): Displays logs in real-time with filtering and statistics
graph LR
A[Client Machines] -->|rsyslog TCP/UDP 514| B[Central Log Server]
B -->|FastAPI + SSE| C[Web Dashboard]
A1[Ubuntu] --> B
A2[Rocky Linux] --> B
A3[Kali Linux] --> B
- π Real-time log streaming from multiple hosts
- π Automatic severity classification (error, warning, info, debug)
- π₯οΈ Host-based filtering
- π Full-text search across log messages
- π Comprehensive statistics dashboard
- π± Fully responsive design
- πΎ Persistent log storage in
/var/log/remote - βοΈ Systemd service for automatic startup
- π Server-Sent Events (SSE) for live updates
- RHEL 8/9
- Python 3.7+
- rsyslog
- Firewall access (ports 514/tcp, 514/udp, 8000/tcp)
- Ubuntu/Rocky/Kali Linux
- rsyslog installed
- Network access to log server
- Node.js 16+
- Modern web browser
logs-server/
βββ src/ # Next.js frontend source
βββ public/ # Static assets
β βββ screenshot.png # Dashboard screenshot
βββ README.md # This documentation
|- back_Log.py
- Install required packages:
sudo dnf install rsyslog python3-pip -y- Configure rsyslog (use the provided
rsyslog.conffromserver_configuration/):
sudo cp server_configuration/rsyslog.conf /etc/rsyslog.conf- Create log directory and set permissions:
sudo mkdir -p /var/log/remote
sudo chmod -R 755 /var/log/remote
sudo systemctl restart rsyslog- Configure firewall:
sudo firewall-cmd --permanent --add-port=514/tcp
sudo firewall-cmd --permanent --add-port=514/udp
sudo firewall-cmd --permanent --add-port=8000/tcp
sudo firewall-cmd --reload- Install Python dependencies:
pip install fastapi uvicorn- Set up FastAPI service:
sudo mkdir -p /root/logs_server
sudo cp server_configuration/main.py /root/logs_server/main.py- Configure systemd service (use provided
logs_server.service):
sudo cp server_configuration/logs_server.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable logs_server.service
sudo systemctl start logs_server.serviceFor each client machine (Ubuntu/Rocky/Kali):
- Install rsyslog if needed:
# Ubuntu/Debian:
sudo apt install rsyslog -y
# Rocky/RHEL:
sudo dnf install rsyslog -y- Configure log forwarding (replace
SERVER_IPwith your RHEL server's IP):
echo '*.* @@SERVER_IP:514' | sudo tee -a /etc/rsyslog.conf
sudo systemctl restart rsyslog- Clone the repository:
git clone https://github.com/NidhalChelhi/logs-server.git
cd logs-server- Install dependencies:
npm install- Configure environment:
echo "NEXT_PUBLIC_LOG_SERVER_URL=http://SERVER_IP:8000" > .env.local- Run the development server:
npm run devFor production:
npm run build
npm run startKey configuration parameters:
LOG_DIR = Path("/var/log/remote") # Log storage directory
SERVER_HOSTNAME = "rhel" # Server's hostname (excluded from logs)
PORT = 8000 # FastAPI server portMain features in rsyslog.conf:
- TCP/UDP reception on port 514
- Log storage by hostname in
/var/log/remote/%HOSTNAME%.log - Standard system log handling
- Cron log filtering
Key service parameters:
- Runs as root (required for log access)
- Automatic restarts on failure
- Security restrictions applied
- Log directory access permissions
- Access the dashboard at
http://localhost:3000(or your server's IP if deployed) - Use the interface controls:
- Search: Filter logs by content
- Host Filter: Select specific machines
- Severity Filter: Show only errors, warnings, etc.
- View real-time statistics in the dashboard
Logs not appearing in dashboard:
# Verify rsyslog is running on clients
sudo systemctl status rsyslog
# Check server connectivity
telnet SERVER_IP 514
# Inspect server logs
sudo tail -f /var/log/remote/*.log
# Check API service status
sudo journalctl -u logs_server.service -fPerformance Optimization:
- Adjust in-memory log limit (
slice(-500)in frontend code) - Increase stats update interval (currently 30s)
- Limit log age with
minutesAPI parameter
-
Current Limitations:
- No authentication implemented
- Service runs as root (required for log access)
- Plain TCP/UDP used for log transmission
-
Recommended Enhancements:
- Implement TLS for rsyslog communication
- Add Basic Auth or JWT for API access
- Configure firewall restrictions
- Consider non-root operation with proper permissions
Planned improvements:
- Add user authentication
- Implement database persistence
- Create alerting/notification system
- Add log rotation/archiving
- Dockerize all components
- Implement TLS encryption
MIT License
For support or contributions, please open an issue on the GitHub repository.
