squid日誌分析分享

2021-12-29 21:14:47 字數 1455 閱讀 8547

配置日誌分析:

yum install httpd gd -y //安裝http和gd庫

tar xf sarg-2.3.11.tar.gz -c /opt/ //解壓日誌分析軟體包

cd /opt/sarg-2.3.11/ //進入解壓後的資料夾中定義

./configure \

--prefix=/usr/local/sarg \ //指定安裝路徑

--sysconfdir=/etc/sarg \ //配置檔案目錄,預設是/usr/local/etc

--enable-extraprotection //新增額外的安全保護

make && make install

vi /etc/sarg/sarg.conf //配置

搜尋並修改一下內容:

access_log /usr/local/squid/var/logs/access.log //squid的訪問日誌位置

title "squid user access reports" //網頁標題

output_dir /var/www/html/squid-reports //分析報告的存放位置

user_ip no //不使用ip代替使用者id

topuser_sort_field bytes reverse //公升序排列

user_sort_field bytes reverse

//在top排序中,指定連線次數、訪問位元組數,採用降序排列,公升序將reverse換為normal

exclude_hosts /usr/local/sarg/noreport //設定不生成報告的主機

overwrite_report no //當那個日期報告已存在,不覆蓋

mail_utility mailx //指定發郵件命令

charset utf-8 //使用字符集

weekdays 0-6 //指定top排序星期週期

hours 7-12,14,16,18-20 //指定top排序時間週期

www_document_root /var/www/html //網頁根目錄

touch /usr/local/sarg/noreport //建立不生成報告的主機列表檔案

ln -s /usr/local/sarg/bin/sarg /usr/local/bin/ //建立軟連線,方便環境變數path識別

sarg //直接輸

出現如圖,表示正常執行

在windows瀏覽器中輸入

squid日誌格式引數詳解

在squid設定有日誌格式設定 logformat squid ts.03tu 6tr a ss 03hs request client 客戶請求 reply server 服務端回應 a address 訪問使用者ip位址 a address name 訪問使用者電腦名稱 h all header...

squid日誌過大處理

squid 預設的 天會壓縮一次,在 etc logrotate.d squid中有設定。如果你修改了日誌的位置,請修改 etc logrotate.d squid home log squid access.log home log squid cache.log home log squid s...

squid日誌配置與輪詢

squid日誌分類及引數 squid預設的log檔案非常多,其中最重要的log日誌有三個,分別為access.log store.log cache.log。三個日誌的記錄的內容如下 access.log 客戶端使用 伺服器的記錄檔案store.log 儲存緩衝物件的狀態記錄檔案cache.log ...