在/etc/ppp/下新建ip-up和ip-down的脚本(本来就有)并且添加执行权限
在ip-up中加入以下内容

#!/bin/shecho "##################################" >> /var/log/pptpd.logecho "Now User $PEERNAME is connected!!!" >> /var/log/pptpd.logecho "##################################" >> /var/log/pptpd.logecho "time: `date -d today +%F_%T`" >> /var/log/pptpd.logecho "clientIP: $6" >> /var/log/pptpd.logecho "username: $PEERNAME" >> /var/log/pptpd.logecho "device: $1" >> /var/log/pptpd.logecho "vpnIP: $4" >> /var/log/pptpd.logecho "assignIP: $5" >> /var/log/pptpd.log

在ip-down中加入以下内容

#!/bin/shecho "#####################################" >> /var/log/pptpd.logecho "Now User $PEERNAME is disconnected!!!" >> /var/log/pptpd.logecho "#####################################" >> /var/log/pptpd.logecho "time: `date -d today +%F_%T`" >> /var/log/pptpd.logecho "clientIP: $6" >> /var/log/pptpd.logecho "username: $PEERNAME" >> /var/log/pptpd.logecho "device: $1" >> /var/log/pptpd.logecho "vpnIP: $4" >> /var/log/pptpd.logecho "assignIP: $5" >> /var/log/pptpd.logecho "connect time: $CONNECT_TIME s" >> /var/log/pptpd.logecho "bytes sent: $BYTES_SENT B" >> /var/log/pptpd.logecho "bytes rcvd: $BYTES_RCVD B" >> /var/log/pptpd.logsum_bytes=$(($BYTES_SENT+$BYTES_RCVD))sum=`echo "scale=2;$sum_bytes/1024/1024"|bc`echo "bytes sum: $sum MB" >> /var/log/pptpd.logave=`echo "scale=2;$sum_bytes/1024/$CONNECT_TIME"|bc`echo "average speed: $ave KB/s" >> /var/log/pptpd.log

然后service pptpd restart就好啦

在/var/log/pptpd.log就看到啦!