Get up and running with Network Logging in 5 minutes!
💡 Best for Always-On Devices: This tool works best on devices that run 24/7 like:
- 🏠 Home servers
- 🥧 Raspberry Pi (any model)
- 💾 NAS devices (Synology, QNAP, etc.)
- 🖥️ Dedicated monitoring PC/old laptop
- ☁️ Cloud VMs
- Linux or macOS
- Python 3.8+
mtrinstalled
Ubuntu/Debian:
sudo apt update && sudo apt install mtr-tiny python3 python3-venvFedora/RHEL:
sudo dnf install mtr python3macOS:
brew install mtrgit clone https://github.com/yourusername/network-logging.git
cd network-logging
⚠️ Important: Always use a virtual environment! This keeps the project isolated from system Python.
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt # Currently no external deps needed!cp config.example.json config.jsonEdit config.json:
- Set
gatewayto your router IP (or use"auto") - Adjust
log_dirif needed
Optional - Discover your ISP hops:
python discover_isp_hops.py
# Add suggested IPs to "isp_targets" in config.jsonpython netLogging.pyCheck the output - you should see:
Network logging gestartet um 2025-10-02 14:35:00
Logs werden gespeichert in: ./logs
Gateway: 192.168.1.1
Verify logs were created:
ls -l logs/
# Should see: netlog.csv and possibly mtr_*.log filesUsing cron (recommended):
# Edit crontab
crontab -e
# Add this line (adjust paths!):
* * * * * /path/to/venv/bin/python /path/to/netLogging.py >> /path/to/logs/cron.log 2>&1Or use the wrapper script:
# Edit start_netlogging.sh with your paths
nano start_netlogging.sh
# Add to crontab
crontab -e
# Add: * * * * * /path/to/start_netlogging.shWait a few hours or days to collect data.
python analyze_netlog.pyThis will show:
- Overall availability
- Outage breakdown
- Gateway latency statistics
- Root cause analysis
Your network is now being monitored continuously. Check logs/netlog.csv anytime to see the data.
- Customize monitoring: Edit
config.jsonto adjust targets, intervals, and features - Review documentation: See README.md for detailed configuration options
- Optimize logging: Reduce
isp_targetsto 1 IP to minimize disk usage
Set it manually in config.json: "gateway": "192.168.1.1"
Install mtr: sudo apt install mtr-tiny (Linux) or brew install mtr (macOS)
Some operations may need sudo: sudo python netLogging.py
- Check
log_dirpath in config.json - Verify write permissions to log directory
- Check cron logs:
tail -f logs/cron.log
See the full README.md or open an issue on GitHub.
Happy monitoring! 📊