Squid access log 的問題

各位兄弟, 我有一些squid access log 的麻煩野

1. 可唔可將squid 的 access log 射去一部syslog server度, 我想請問個squid既config file 應該點set
2. 我見部機squid 都用了一段日子, 擔心部squid server的 access log 會爆, 我想請問可唔可以人手delete同埋做backup, 假若delete佐之後, 佢會唔會識得自己生返出黎呢? (參考圖 access_log.jpg, access_log2.jpg)
3. 當我用tail -n 50 /var/log/squid/access.log 睇的時候, 我發覺access log 的時間用了unix time (seconds since Jan 1, 1970) with millisecond resolution, 我想請問可以set回作dd/mm/yyyy嗎? (參考圖 proxy_log.jpg)

謝謝

[ 本帖最後由 andywinky 於 2009-1-19 14:36 編輯 ]
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

小弟係一個新手 我有依幾個答案

1.syslog server起個nfs service  之後可以用crontab 係一
某一個時間去 搬去 個 server 度

2. 你可以參考 這裏 http://linux.vbird.org/linux_basic/0570syslog.php  
起其他website 有個案話 會用埋 crontab + syslog 行

3. 這一條問題 留比 進階人仕 解答 因為我唔識

[ 本帖最後由 hungjoyee 於 2009-1-19 14:54 編輯 ]

TOP

原帖由 hungjoyee 於 2009-1-19 14:53 發表
小弟係一個新手 我有依幾個答案

1.syslog server起個nfs service  之後可以用crontab 係一
某一個時間去 搬去 個 server 度

2. 你可以參考 這裏 http://linux.vbird.org/linux_basic/0570sys ...

多謝回覆, 請問答案1, 有冇website可以講解

TOP

原帖由 andywinky 於 2009-1-19 15:34 發表

多謝回覆, 請問答案1, 有冇website可以講解


website 有 http://linux.vbird.org/linux_server/0330nfs.php <-nfs service 安裝 同設定
http://linux.vbird.org/linux_basic/0430cron.php <-crontab 使用方法

TOP

原帖由 andywinky 於 2009-1-19 14:35 發表
各位兄弟, 我有一些squid access log 的麻煩野

1. You CAN!!! http://www.squid-cache.org/Doc/config/access_log/
    But some article does not suggest as it is quite large in size and traffic consumption.
2. How about logrotate ??
3. You can change your log format.
But, your current format is program-friendly.
If you use the access.log w/ other analyzer, I suggest to keep the format and use a filter
to tranlate the log for you.

TOP

Rotate log:

squid -k rotate

TOP

2. You should not delete the log file, you can run "cp /dev/null access_log" to empty log files.
You can also add "logfile_rotate 10"  into your squid.conf, and add a cronjob to run "squid -k rotate" everyday. Then you can rename and ftp/rsync/copy via NFS your logs to another server.

3. You can add "emulate_httpd_log on" in your squid.conf, then the log will output like Apache stardard access log format

TOP

原帖由 andywinky 於 19-1-2009 14:35 發表
2. 我見部機squid 都用了一段日子, 擔心部squid server的 access log 會爆, 我想請問可唔可以人手delete同埋做backup, 假若delete佐之後, 佢會唔會識得自己生返出黎呢?


squid access log, 我試過完全 delete 晒都無問題,到時候 squid 會自己重新 create 過一個 file 用黎寫 log
如果你認為無需要, access log 係 squid.conf 入邊係可以唔要, 好似係 remark 左就唔會寫 acees log
若你又想保留既話,可以用 cron job (crontab -e), 定期 tar + zip 起佢,咁未無咁食 file space 咯
個人做法,不如定期行 cron run tar + zip, 其至寫埋一段時間後 delete 舊 log, 當然人手 delete 都可以
雖然 syslog 係一個好方法,但係未搵到點 forward 去 syslog 之前, cron job 去 tar + zip, 會唔會較方便???

[ 本帖最後由 我係一舊雲 於 2009-1-20 16:58 編輯 ]

TOP