purftpd的4种日志格式对中文文件名的支持情况:
purftpd的4种日志格式分别是xferlog,w3c,stats,clf,之前使用时clf,类似apache日志格式的日志,但是其transfer.log中的中文名字无法正
常显示,尝试用iconv转码也不行,用file命令检查是ascii格式的:
root@233:/etc# file /var/log/pure-ftpd/info.log
/var/log/pure-ftpd/info.log: UTF-8 Unicode text
root@233:/etc# file /var/log/pure-ftpd/transfer.log
/var/log/pure-ftpd/transfer.log: ASCII text
purftpd支持的4种日志格式及举例:
1、xferlog:/var/log/pure-ftpd/transfer.log
Tue May 24 10:34:53 2011 0 192.168.1.200 12674 /data/ftp/test/解析.png b _ i r cpadmin ftp 1 * c
2、w3c:/var/log/pure-ftpd/transfer.log
2011-05-24 02:30:40 192.168.1.200 []created /data/ftp/test/%E5%88%B0%E5%85%AB%E4%B8%80%E5%AD%98%E5%82%A89Mbps.png 226 cpadmin
9679
3、stats:/var/log/pure-ftpd/transfer.log
1306204017 4ddb1755.1108 cpadmin 192.168.1.200 U 354501 1 /data/ftp/test/成功从底层开始.txt
使用purftpd自带的pure-statsdecode命令将transfer.log的时间戳转换为方便阅读的格式:
pure-statsdecode /var/log/pure-ftpd/transfer.log
2011/05/24 10:26:57 4ddb1755.1108 cpadmin 192.168.1.200 U 354501 1 /data/ftp/test/成功从底层开始.txt
The Stats format is:
<date> <session id> <user> <ip> <U or D> <size> <duration> <file>
<date> is a GMT timestamp (time()) and <session id> identifies the current
session. <file> is unquoted, but it's always the last element of a log line.
"U" means "Upload" and "D" means "Download".
Warning: the session id is only designed for statistics purposes. While it's
always an unique string in the real world, it's theoretically possible to have
it non unique in very rare conditions. So don't rely on it for critical
missions.
A command called "pure-statsdecode" can be used to convert timestamps into
human-readable dates.
4、Apache-like
clf:/var/log/pure-ftpd/transfer.log
192.168.1.200 - cpadmin [24/May/2011:10:25:22 +0800] "PUT /data/ftp/test/%E6%88%90%E5%8A%9F%E4%BB%8E%E5%BA%95%E5%B1%82%E5%BC
%80%E5%A7%8B.txt" 200 354501