scribe日誌系統安裝筆記
目前web訪問日誌爲crontab定時清空,而且負載均衡後,訪問隨機分配到一臺服務器。程序出錯後需要分析日誌時,需要登錄幾臺機器查看,於是想用一臺主機作日誌主機,負責收集(按時間順序而不用sort?)、分析日誌。下面的是年前安裝scribe日誌系統的記錄。
一、軟件下載
wget http://www.monkey.org/~provos/libevent-2.0.10-stable.tar.gz
wget http://nchc.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.bz2
wget http://apache.etoak.com//incubator/thrift/0.5.0-incubating/thrift-0.5.0.tar.gz
wget https://download.github.com/facebook-scribe-2ee14d3.tar.gz
wget http://cloud.github.com/downloads/facebook/scribe/scribe-2.2.tar.gz
二、安裝步驟
1~4系統已經安裝過,下面安裝略過,未安裝的可yum install libevent進行安裝。
1、gcc> 3.3.5
gcc -v
which gcc
2、安裝ruby
3、安裝python
4、安裝libevent
5、安裝 boost
tar jxvf boost_1_45_0.tar.bz2
cd boost_1_45_0
./bootstrap.sh
./bjam -s HAVE_ICU=1 --prefix=/usr/local/boost --includedir=/usr/local/boost/include --libdir=/usr/local/boost/lib
./bjam install --prefix=/usr/local/boost
6、安裝facebook 服務
安裝thrift tar zxvf thrift-0.5.0.tar.gz
cd thrift-0.5.0
./configure --with-boost=/usr/local/boost --with-php-config=/usr/local/php5/bin/php-config
make
(出現如下錯誤,編輯文件lib/cpp/src/concurrency/ThreadManage.h修改爲
24 #include <boost/tr1/tr1/functional>後,重新make)
make install
安裝fb303
cd contrib/fb303
(目錄下沒有Makefile.in,將thrift目錄下的Makefile.in至fb303目錄下)
./bootstrap.sh
./configure --with-boost=/usr/local/boost
make
make install
7、安裝scribe
環境變量
export BOOST_ROOT=/usr/local/boost
export
LD_LIBRARY_PATH=/usr/local/boost/lib::/usr/lob:/usr/local/lib
ldconfig -v
tar zxvf facebook-scribe-2ee14d3.tar.gz (scribe需要在github上下載最新版,scribe2.2發佈版與thrift0.5.0不兼容,Ying-Yi Liang搞定並更新了)
cd facebook-scribe-2ee14d3
./bootstrap.sh
./configure --with-boost=/usr/local/boost
--prefix=/usr/local/scribe
make
make install
8、配置測試
mkdir /usr/local/scribe/conf
cp examples/example1.conf /usr/local/scribe/conf
/usr/local/scribe/bin/scribed -c
/usr/local/scribe/conf/example1.conf
/usr/local/scribe/bin/scribed -c
/usr/local/scribe/conf/example1.conf &
nohup /usr/local/scribe/bin/scribed -c
/usr/local/scribe/conf/example1.conf &
exit
測試程序:
mkdir /tmp/scribetest
測試寫入:
echo "hello world"|
/usr/local/softs/facebook-scribe-2ee14d3/examples/scribe_cat test
查看結果:
cat /tmp/scribetest/test/test_current
9、配置PHP接口
1)生成PHP庫及配置目錄
cd /usr/local/scribe
2)編寫測試程序:
3)執行程序:
/usr/local/php5/bin/php test.php
4)查看結果:
cat /tmp/scribetest/keyword/keyword_current
三、相關文章
多個服務器日誌的排序合併: clfmerge
scribe的安裝與使用
scribe-日誌收集器分析
使用Scribe來監控大型網絡系統
nginx-scribe-log
Scribe PHP logging
Pipe Apache (or any) Logs to Scribe
參考:
scribe日誌系統安裝筆記
Facebook scribe在Ubuntu下面安裝筆記