Capture nethogs output in log file

Viewed 9889

I want to check the network bandwidth used by my process. For this i found that nethogs tool is useful. Using this tool i can see which process is eating up a network bandwidth and process behaviour. But how do I capture data from nethogs for a my process and store it into log file ?

4 Answers

You can run nethogs in background in tracemode and write output to a file like this:

sudo nethogs -t eth1 &> /var/tmp/nethogs.log & 

Download and build the nethogs-parser as described here.

Then after you have accumulated enough data you can run the parser to see the results:

./hogs -type=pretty /var/tmp/nethogs.log 

Make sure to kill the running nethogs process when you are done collecting data.

More info here on automating the task.

Related