mysql logging

There’re 2 ways to enable mysql query logs

in /etc/my.cnf

log=/var/log/mysqld-query.log

or add ” –log” in start script

/usr/bin/mysqld_safe –datadir=”$datadir” …. –log >/dev/null 2>&1 &

How to stop binary log
remove the following from my.cnf

log-bin=mysql-bin
binlog_format=mixed

telnet smtpserver 25

HELO smtp.lalife.net
MAIL FROM: test@localhost
RCPT TO: test@lalife.net
DATA
FROM:test@localhost
Subject: test smtp
test smtp.
.
QUIT

Another way to send mail by command line
echo “testmail” | mail -s “test” yan@yan.lalife.net

iptraf

iptraf is a tool used to monitor the network traffic

To add more ports (beyond 104)
iptraf > Enter > Configure > Additional Ports

To change log interval
iptraf > Enter > Timers > Logging interval

Add/Delete/Active/Unactive Filter
iptraf > Enter > IP

Monitor traffic statistics by port
iptraf > Enter > Statistical breakdowns…

To run iptraf background for 10 min and send data to log files
/usr/bin/iptraf -B -s eth0 -t 10

Log file is under /var/log/iptraf/ by default

vnstat — monitoring network traffic

Install vnstat
tar -zxvf vnstat-1.xx.tar.gz

Compile and install
make all
make install

Use vnstat
create new database
vnstat -u -i eth0
database is created under /var/lib/vnstat/eth0

Setup cron to collect data
copy from examples/vnstat.cron

#vnstat
#vnstat -i eth0
#vnstat -d
#vnstat -m

rx = recieved
tx = transmitted