Created
May 5, 2021 02:42
-
-
Save seanhsu0102/db57ac1ec9764dea3c98b76b3badb4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#取得前十名 access 最多的 IP 位址 | |
cat access_log|awk '{print $1}'|sort|uniq -c|sort -nr|head -10 | |
#取得前十名 access 最多的網頁 | |
cat access_log|awk '{print $11}'|sort|uniq -c|sort -nr|head -10 | |
#取得前十名下載流量最大的 zip 檔案 | |
cat access.log |awk '($7~/\.zip/){print $10 " " $1 " " $4 " " $7}'|sort -nr|head -10 | |
#取得前十名 Loading 最大的頁面 (大於60秒的 php 頁面) | |
cat access_log |awk '($NF > 60 && $7~/\.php/){print $7}'|sort -n|uniq -c|sort -nr|head -10 | |
#取得前十名 User access 最久的頁面 | |
cat access_log |awk '($7~/\.php/){print $NF " " $1 " " $4 " " $7}'|sort -nr|head -10 | |
#取得 access log 平均流量 (GB) | |
cat access_log |awk '{sum+=$10} END {print sum/1024/1024/1024}' | |
#取得所有 404 Link | |
awk '($9 ~/404/)' access_log | awk '{print $9,$7}' | sort | |
#取得所有 access code 的 stats 數量 | |
cat access_log | awk -F' ' '$9 == "400" || $9 == "404" || $9 == "408" || $9 == "499" || $9 == "500" || $9 =="502" || $9 =="504" {print $9}' | sort | uniq -c | more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment