#!/bin/bash#this script used montor mysql network traffic.echo sqltcpdump -i bond0 -s 0 -l -w - dst
#!/bin/bash
#this script used montor mysql network traffic.echo sql
tcpdump -i bond0 -s 0 -l -w - dst port 3307 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
{
if (defined $q) { print "$q/n"; }
$q=$_;
} else {
$_ =~ s/^[ /t]+//; $q.=" $_";
}
}'