Linux Apache日誌分析--命令

來源:互聯網
上載者:User

標籤:linux apache 日誌分析命令

1.獲得訪問前10位的ip地址
cat access.log|awk ‘{print $1}’|sort|uniq -c|sort -nr|head -10


2.訪問次數最多的檔案或頁面,取前10
cat access.log|awk ‘{print $11}’|sort|uniq -c|sort -nr|head -10

3.列出傳輸最大的幾個exe檔案
cat access.log |awk ‘($7~/\.exe/){print $10 ” ” $1 ” ” $4 ” ” $7}’|sort -nr|head -20

4.列出輸出大於300000byte(約300kb)的exe檔案以及對應檔案發生次數
cat access.log |awk ‘($10 > 300000 && $7~/\.exe/){print $7}’|sort -n|uniq -c|sort -nr|head -100

5.列出到用戶端最耗時的頁面
cat access.log |awk ‘($7~/\.php/){print $NF ” ” $1 ” ” $4 ” ” $7}’|sort -nr|head -100

6.列出最最耗時的頁面(超過60秒的)的以及對應頁面發生次數
cat access.log |awk ‘($NF > 60 && $7~/\.php/){print $7}’|sort -n|uniq -c|sort -nr|head -100

7.列出傳輸時間超過30秒的檔案
cat access.log |awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20

8.統計網站流量(G)
cat access.log |awk ‘{sum+=$10} END {print sum/1024/1024/1024}’

9.統計404的串連
awk ‘($9 ~/404/)’ access.log | awk ‘{print $9,$7}’ | sort

10. 統計http status
cat access.log |awk ‘{print $9}‘|sort|uniq -c|sort -rn

本文出自 “實用Linux知識技能分享” 部落格,請務必保留此出處http://superleedo.blog.51cto.com/12164670/1886254

Linux Apache日誌分析--命令

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.