Centos5.5安装syslogng3.5.4.1

来自技术开发小组内部wiki
跳转至: 导航搜索

安装eventlog

<source lang="bash"> tar zxvf eventlog_0.2.12.tar.gz cd eventlog-0.2.12+20120504+1700 ./configure --prefix=/opt/eventlog make make install </source>

安装libol

<source lang="bash"> tar zxvf libol-0.3.18.tar.gz cd libol-0.3.18 ./configure --prefix=/opt/libol make make install </source>

安装Python-2.5.4

syslog-ng3.5.4.1需要python 2.5以上版本,并需要json,否则无法安装 <source lang="bash"> tar jxvf Python-2.5.4.tar.bz2 cd Python-2.5.4 ./configure make all make install make clean make distclean </source> 修改系统链接 <source lang="bash"> mv /usr/bin/python /usr/bin/python.bak ln -s /usr/local/bin/python2.5 /usr/bin/python </source> 修改yum配置,系统默认yum使用的是2.4的版本,要修改yum配置文件使用python2.4 <source lang="bash"> vi /usr/bin/yum

  1. !/usr/bin/python 修改为: #!/usr/bin/python2.4

</source> 安装json <source lang="bash"> uzip -d json-py-3_4.zip mv json.py /usr/local/lib/python2.5 mv jsontest.py /usr/local/lib/python2.5 mv minjson.py /usr/local/lib/python2.5 </source>

安装syslogng3.5.4.1

<source lang="bash"> export PKG_CONFIG_PATH=/opt/eventlog/lib/pkgconfig/ tar zxvf syslog-ng_3.5.4.1.tar.gz cd syslog-ng-3.5.4.1 ./configure --prefix=/opt/syslog-ng --with-libol=/opt/libol/ make make install </source> 修改配置文件 <source lang="bash"> vi /opt/syslog-ng/etc/syslog-ng.conf 添加 destination d_tcp { tcp("111.205.96.15" port(514)); }; log { source(s_local); destination(d_tcp); }; </source> 添加启动 <source lang="bash"> cp syslog-ng-3.5.4.1/contrib/rhel-packaging/syslog-ng.init /etc/init.d/syslog-ng </source> 修改/etc/init.d/syslog-ng <source lang="bash"> vi /etc/init.d/syslog-ng 修改binary="/sbin/syslog-ng"为binary="/opt/syslog-ng/sbin/syslog-ng" </source> 为syslog-ng添加权限 <source lang="bash"> chmod a+x /etc/init.d/syslog-ng </source>

停用系统的syslog服务并启用syslog-ng

<source lang="bash"> chkconfig --level 2345 syslog off service syslog stop chkconfig --add syslog-ng chkconfig --level 2345 syslog-ng on service syslog-ng start </source>