I need to keep a running total of the number of bytes passed between my server and a remote server (port unspecific). I would like to keep this running total written in a file. I'm a bit new to IPtables but I'm unsure if I would need to queue all of the matched packets to be processed by a script (don't know python, but a total byte read likely wouldn't be too hard). IPtables seems like it could do this out of the box with a log but the documentation is burying me a little bit.
iptables -I INPUT 1 -s <remote ip>/8 -j QUEUE ???
iptables -I OUTPUT 1 -d <remote ip>/8 -j QUEUE ???
Any help on pointing it to a python file or a iptables chain that would handle this out of the box would be great.