Admins eHow SysAdmin Tips & Tricks

September 6, 2014

Send weekly reports of IPs logged into vsftpd

Filed under: linux — Tags: , , , — admin @ 10:25 am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@X:[/etc/logrotate.d]: cat /etc/logrotate.d/vsftpd
 
/var/log/vsftpd.log
{
        create 640 root adm
 
        # ftpd doesn't handle SIGHUP properly
        missingok
        notifempty
        rotate 4
        weekly
        prerotate
                echo "<html><body><table>$(grep "OK LOGIN" /var/log/vsftpd.log | awk '{print $8" "$12'} | sort | uniq -c | awk '{print "<tr><td>"$2"</td><td>"$3"</td><td>"$1"</td></tr>"}')</table></body></html>" | mail -a "Content-type: text/html" -s 'FTP REPORT' mail@domain.com
        endscript
}

Powered by WordPress