2014年1月27日 星期一

如何在Fedora 上 安裝rsyslog 7.4.9

舊的rsyslog,對於Cisco ASR的支援很差,因此直接裝上新版。

過程有點麻煩,記錄備查。

先安裝libestr:

 wget http://libestr.adiscon.com/files/download/libestr-0.1.9.tar.gz
 tar xvzf libestr-0.1.9.tar.gz
 cd libestr-0.1.9
  ./configure
  make && make install

再安裝json:
wget https://github.com/json-c/json-c/archive/json-c-0.11-20130402.tar.gz --no-check-certificate
tar xvzf json-c-0.11-20130402
cd json-c-json-c-0.11-20130402
./configure
make && make install

接著安裝docutils:
wget https://pypi.python.org/packages/source/d/docutils/docutils-0.11.tar.gz --no-check-certificate
tar xvzf docutils-0.11.tar.gz
cd docutils-0.11
python setup.py install
ln -s /usr/bin/rst2man.py /usr/bin/rst2man

再來安裝liblogging,我們要的是裡面的libstdlog.h和libstdlog.so
wget http://ftp5.gwdg.de/pub/linux/archlinux/community/os/x86_64/liblogging-1.0.0pre-1-x86_64.pkg.tar.xz
tar xvf liblogging-1.0.0pre-1-x86_64.pkg.tar.xz
cd /usr/src/usr/lib/
mv * /usr/lib
cd ../include/
mv * /usr/include/

再安裝uuid相關套件
yum -y install uuid uuid-devel libuuid libuuid-devel

再補一下libgrcypt套件與發展程式:
yum -y install libgcrypt libgcrypt-devel

最後回到重頭戲:
wget http://www.rsyslog.com/files/download/rsyslog/rsyslog-7.4.9.tar.gz
tar xvzf rsyslog-7.4.9.tar.gz 
cd rsyslog-7.4.9
./configure --prefix=/opt/rsyslog --enable-mysql PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ LIBLOGSTD_CFLAGS=/usr/local/include/liblogging LIBLOGSTD_LIBS=/usr/lib/libstdlog.so
make && make install

停掉原有的rsyslog,再執行新的就ok了。

理論上 LD_LIBRARY_PATH要把剛剛的libstdlog.so所在的目錄export出去,不然會找不到。

但這樣做的時候service rsyslog restart會找不到so檔。

因此最後的解法是:
cp /opt/rsyslog/lib/rsyslog/libstdlog.so* /lib64/

正規的解釋如下:

Libraries have been installed in:
   /opt/rsyslog/lib/rsyslog

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

參考網頁:http://www.07net01.com/storage_networking/Rsyslog__loganalyzerrizhifuwuqidajian_586293_1379322838.html

2 則留言:

  1. 請教大大,ASR的支援很差,是例如哪樣,能舉個例嗎。不曉得原來這個syslog 也需更新

    回覆刪除
    回覆
    1. sorry, 現在才注意到有這個留言。有點久了..印象中好像是格式的parser問題,負責處理syslog的同事很頭痛最後和他討論後才決定更新的。

      刪除