使用goaccess进行处理、统计
goaccess -p /opt/goaccess-1.5.5/config/goaccess.conf -o goaccess.html --real-time-html --daemonize
goaccess /usr/local/nginx/logs/access.log -o /usr/local/nginx/logs/goaccess.html --real-time-html --daemonize
goaccess access.log -o goaccess.html --real-time-html --daemonize
cat access*.log | goaccess -o report.html --time-format=%T date-format=%d/%b/%Y --log-format=COMBINED
cat access*.log |goaccess -p /opt/goaccess-1.5.5/config/goaccess.conf -o report.html
使用shell语句进行处理、统计
cat access.log |awk ‘{print $7}’ |wc -l
awk ‘{print $7}’ access.log | sort |uniq -c | sort -rn | head -n 10
cat access.log |awk ‘{print $4, 7 , s u b s t r ( 7,substr( 7,substr(NF,2,5)}’ | awk -F ‘"’ ‘{print $1,$2,$3}’ | sort -k3 -rn | head -10
grep ‘/iscp/diagram/getTreeData’ /logs/iscp-info.log |awk -F ‘\||:|,|,’ ‘{print $2,$7,$9,$11}’|sort -k4 -rn | head -10
grep ‘/iscp/diagram/getTreeData’ /logs/iscp-info*.log |awk -F ‘\||:|,|,’ ‘{print $2,$7,$9,$11}’|sort -k4 -rn | head -10
grep ‘/iscp/’ /logs/iscp-info.log |awk -F ‘\||:|,|,’ ‘{print $2,$7,$9,$11}’|sort -k4 -rn | head -10
grep '/iscp/’ /logs/iscp-info*.log |awk -F ‘\||:|,|,’ ‘{print $2,$7,$9,$11}’|sort -k4 -rn | head -10
grep ‘url’ access.log | awk ‘{print $4,
7
,
7,
7,(NF-1)}’| sort -k3 -rn | head -10
grep ‘url’ /logs/info.log | awk -F ‘\||:|,|,’ ‘{print $2,$7,$9,$11}’|sort -k4 -rn | head -10