Friday, 30 October 2009

Monitor SOAP traffic with tcpdump, a crude alternative to TcpMon if you're really desperate

I've started working with SOAP again, using Axis2, and I've been
trying to use the TcpMon application to monitor XML traffic to and
from webservices. However, it performs like shit, and I'm not sure if
it's because of the app or because my machine only has 1Gb.

Anyway, I looked for something more lightweight, and came across a
blog post for tcpdump.

So to monitor the Axis2 webapp running on Tomcat at port 8080, I type
in this as root (or use sudo! i know i know..)

/usr/sbin/tcpdump -i lo -A -s 8080 -l 'dst host localhost and port
8080' | tee dump.log

this creates a file called dump.log which contains the packets going
over the loopback interface on port 8080

I wouldn't want to do it very often, but in a pinch, it works, and
doesnt take over my machine.

Of course, you'd only want to do it on a machine where *you* control
what requests come in. On a production box the best you can do is
create a log and process it later to find what you want. No humanly
way of eyeballing the logs in real-time in that scenario. =)

No comments: