处理Apache日志
1 awk '{if(($9 >= 200) && ($9<=400)) {print $7}}' $HOME/log/apache/$(date +apache_albumecnps_%Y%m%d.log --date "-1 day") | grep '/download.html?promotion-id=\w' | sort | uniq -c | sed 's/^ *//g' | sort -rn | sed 's/\/.*?promotion-id\=//'
1. 日志记录
127.0.0.1 - - [02/Nov/2016:09:42:45 +0800] "GET /download.html?promotion-id=weibo_2 HTTP/1.1" 200 3094 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0"
2. awk
awk '{if(($9 >= 200) && ($9<=400)) {printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t\n",$7,$9,$11,$12,$13,$14,$15,$16,$17,$18,$19);}}' apache_albumecnps_20161206.log | grep '/albume/download/app?.*promotion-id=.*'
浙公网安备 33010602011771号