I haven't tried the following solution, but if you have a compatible Linksys router (or maybe other manufacturers), you can enable the logging feature (as codewarrior already suggested. Thanks to him). Then, you need to specify the IP address where you want the logs to be stored (your RPi's).
On your RPi, install one of the implementation of syslog
. syslog-ng
or rsyslog
for instance:
sudo apt-get install syslog-ng-core
Then, configure /etc/syslog-ng/syslog-ng.conf
, and add the following lines:
source s_myrouter {
udp(ip(0.0.0.0) port(514));
};
filter f_myrouter { host("192.168.1.1"); }; # replace with your router's IP address
destination d_myrouter { file("/var/log/myrouter.log"); }; # replace with where you want to log
log { source(s_myrouter); filter(f_myrouter); destination(d_myrouter); };
You will probably have to adapt f_filter
to your needs to avoid to /var/log/myrouter.log
to take hundreds of megabytes.
Then, you will need to parse /var/log/myrouter.log
with a script to extract the information you want.
PiSQL
<- not sure what that is but it sounds good. (MySQL)