I am making a logging tool for our server that is supposed to log size of packets sent to the servlet post method. Now the issue is that the content of the request isn't only the only thing that counts towards traffic. The payload is in this case way larger than the content itself. Is there a way to specifically get the whole size of packet with headers, content and all other parts of payload? To make things harder, calculating overall network traffic or such thing would not work as purpose of this is to calculate different clients sent packet sizes and add those to Database.

What would be the best method to start solving this issue? I don't seem to get wanted information out of the request in any way i have tested so far.