Linux與Windows系統下Cronolog安裝配置

來源:互聯網
上載者:User

前言:

發現WEB伺服器上有一個檔案一直在不斷增長而且速度還很快,一看是記錄檔,已經達到一個G了。但又想留下最新的一些日誌,不想一下都刪除了,但記錄檔太大,根本就打不開。其實這時最好用日誌輪詢,之前這個WEB伺服器沒有做這個配置,本應該配置WEB伺服器時就應該做的。現在配置下也不晚。

1.首先得要軟體,下載:http://cronolog.org/download/index.html

Version 1.6.2 released 2002-01-24 (gzip'ed tar file)

Version 1.6.1 released 1999-12-20 (gzip'ed tar file)

Win 32 version (ZIP file)

Version 1.6 released 1999-12-16 (gzip'ed tar file)

Version 1.5b9 released on 4 June 1998 (gzip'ed tar file)

Version 1.4 released 20 December 1996 (gzip'ed tar file)

如果有Windows的要下Win_32_version(ZIP file) Linux習慣用哪種包就用哪種.

2. 在Linux 下安裝cronolog

tar zxvf cronolog-1.6.2.tar.gz

cd cronolog-1.6.2

./configure (注意:預設是安裝在/usr/local下 cronolog的命令在/usr/local/sbin下,這個要清楚)

make ; make install

3.在Windows下安裝cronolog

在Windows下很簡單,直接把cronolog.exe解壓Copy到apache目錄下的bin目錄中.

注意:配置都是一樣的格式,不過要注意Linux和Windows下斜杠的方向.

Linux下

例:cronolog命令在/usr/local/sbin 下 記錄檔在 /usr/local/apache2/logs/下

在FormatLog附近加入兩句:

CustomLog "|/usr/local/sbin/cronolog logs/access_%Y%m%d.log" combined

ErrorLog "|/usr/local/sbin/cronolog logs/error_%Y%m%d.log"

Windows下

例:cronolog命令在apache的bin中 記錄檔在D:/logs

CustomLog "|bin/cronolog D:/logs/access_%Y%m%d.log" combined

ErrorLog "|bin/cronolog D:/logs/error_%Y%m%d.log"

(注意:斜杠方向都在Linux下是一樣的,不跟Windows的習慣一樣)

如果有虛擬機器主機,虛擬機器主機也要配置,例如:

<VirtualHost *:80>ServerName www.domain.comCustomLog "|bin/cronolog.exe D:/logs/access_%Y%m%d.log" combinedErrorLog "|bin/cronolog.exe D:/logs/error_%Y%m%d.log"</VirtualHost>

4.重啟服務就可以看到產生了一個新的記錄檔。

相關文章】

  • 安裝cronolog格式化Apache的記錄檔
  • linux系統安全要素之一:日誌
  • 深入討論Linux系統日誌管理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.