<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://blog.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://blog.liuts.com/post/207/</link>
<title><![CDATA[LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>刘天斯 &lt;liutiansi@gmail.com&gt;</author>
<category><![CDATA[Linux]]></category>
<pubDate>Thu, 22 Jul 2010 09:32:23 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/</guid> 
<description>
<![CDATA[ 
	<strong>一、前言</strong><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 目前查看系统日志比较被动，遇到系统不正常或故障时才会主动去检查服务器系统日志，这样一来不能及时了解系统的运行情况，因此部署Logzilla+sphine+syslog-ng来弥补这不足。以下为安装、部署平台详细步骤。(Logzilla是什么新东西？其实前身就是php-syslog-ng，引用作者的话“Php-syslog-ng is now known as LogZilla. Same owner, better code :-)”)<br/><br/><strong>二、平台初始化</strong><br/>#yum install libdbi* libnet<br/>#cpan Date::Calc Text::LevenshteinXS String::CRC32<br/><br/><strong>三、下载相关包</strong><br/>#cd /home/install<br/>#mkdir logzilla;cd logzilla<br/>#wget http://www.balabit.com/downloads/files/eventlog/0.2/eventlog_0.2.9.tar.gz<br/>#wget http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/3.0.3/setups/rhel-5-i386/syslog-ng-3.0.3-1.rhel5.i386.rpm<br/><br/><strong>四、开始安装</strong><br/># cp eventlog_0.2.9.tar.gz /usr/src/redhat/SOURCES/<br/># tar zxvf&nbsp;&nbsp;eventlog_0.2.9.tar.gz<br/># cd eventlog-0.2.9/<br/># rpmbuild --ba eventlog.spec.bb<br/># cd /usr/src/redhat/RPMS/x86_64<br/># rpm -Uvh libevtlog*<br/><br/>#cd /home/install/logzilla<br/>#rpm -Uvh syslog-ng-3.0.3-1.rhel5.i386.rpm<br/><br/><strong>五、安装logzilla</strong><br/>#cd /www/webroot/<br/>#wget http://php-syslog-ng.googlecode.com/files/logzilla_3.0.85.tgz<br/>#tar -zxvf logzilla_3.0.85.tgz<br/>#cd logzilla/scripts<br/>#./install.pl<br/>(根据实际情况来回应就OK了)<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>===================<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LogZilla Installation<br/><br/>====================<br/><br/>Enter the MySQL root username [root]: <br/>Enter the password for root [mysql]: <br/>Database to install to [syslog]: <br/>Database table to install to [logs]: <br/>Enter the name of the MySQL server [127.0.0.1]: <br/>Enter the port of the MySQL server [3306]: <br/>Enter the name to create as the owner of the logs database [syslogadmin]: <br/>Enter the password for the syslogadmin user [syslogadmin]: <br/>Enter the name to create as the WEBSITE owner [admin]: <br/>Enter the password for admin [admin]: <br/>Enter your email address [cdukes@cdukes.com]: <br/>Enter a name for your website [The home of LogZilla]: <br/>Enter the base url for your site (include trailing slash) [/logs/]: /<br/>Where should log files be stored? [/var/log/logzilla]: <br/>How long should I keep old logs? (in days) [30]: <br/>========================================<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path Updates<br/><br/>========================================<br/><br/>Getting ready to replace paths in all files with "/www/webroot/logzilla"<br/>Ok to continue? [y]: <br/>Updating file paths<br/>Modifying ../scripts/db_insert.pl<br/>Modifying ../scripts/contrib/system_configs/logzilla.crontab<br/>Modifying ../scripts/contrib/system_configs/syslog-ng.conf<br/>Modifying ../scripts/contrib/system_configs/logzilla.apache<br/>Modifying ../sphinx/indexer.sh<br/>Modifying ../sphinx/sphinx.conf<br/>Updating log paths<br/>Modifying ../scripts/contrib/system_configs/logzilla.crontab<br/>Modifying ../scripts/contrib/system_configs/logzilla.logrotate<br/><br/>====================<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Database Installation<br/><br/>====================<br/><br/>All data will be installed into the syslog database<br/>Ok to continue? [y]: <br/><br/><br/>====================<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Config.php generation<br/><br/>====================<br/><br/><br/>Generating /www/webroot/logzilla/html/config/config.php<br/>Ok to continue? [y]: <br/><br/><br/>====================<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System files<br/><br/>====================<br/><br/>Adding LogZilla logrotate.d file to /etc/logrotate.d<br/>Ok to continue? [y]: <br/>Where is your syslog-ng.conf file located? [/etc/syslog-ng/syslog-ng.conf]: /opt/syslog-ng/etc/syslog-ng.conf<br/>Adding syslog-ng configuration to /opt/syslog-ng/etc/syslog-ng.conf<br/>Ok to continue? [y]: <br/>Found 1 sources<br/>Which source definition would you like to use? [s_all]: <br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LogZilla installation complete...<br/>Note: you may need to enable the MySQL Event Scheduler in your /etc/my.cnf file.<br/>Please visit http://forum.logzilla.info/index.php/topic,71.0.html for more information.<br/><br/>Also, please visit http://nms.gdd.net/index.php/Install_Guide_for_LogZilla_v3.0#UDP_Buffers to learn how to increase your UDP buffer size (otherwise you may drop messages).<br/><br/>Please run /etc/init.d/syslog-ng restart<br/></div></div><br/><br/><strong>六、安装 Sphinx</strong><br/>#cd logzilla/sphinx/src<br/>#tar xzvf sphinx-0.9.9.tar.gz<br/><br/>#cd sphinx-0.9.9<br/>#./configure --prefix `pwd`/../..<br/>#make && make install<br/><br/>#cd /www/webroot/logzilla/sphinx<br/>#vi sphinx.conf<br/>#!/usr/bin/php 替换成实际php的位置，如#!/usr/local/php/bin/php<br/>#./indexer.sh full<br/>#bin/searchd<br/><br/>提示：<br/>ERROR: index 'idx_logs': sql_query_pre[0]: Column 'max_id' cannot be null (DSN=mysql://syslogadmin:***@127.0.0.1:3306/syslog).<br/>如果看到该信息，属正常，因为现在还没有数据:)<br/><br/>添加作业：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>30 0 1 * */www/webroot/logzilla/sphinx/indexer.sh full >>/www/webroot/logzilla/sphinx/log/sphinx_indexer.log 2>&1<br/>*/5 * * * */www/webroot/logzilla/sphinx/indexer.sh delta >>/www/webroot/logzilla/sphinx/log/sphinx_indexer.log 2>&1<br/>0 0 * * */www/webroot/logzilla/sphinx/indexer.sh merge >>/www/webroot/logzilla/sphinx/log/sphinx_indexer.log 2>&1<br/></div></div><br/><br/>添加rc.local<br/>#vi /etc/rc.local<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>/www/webroot/logzilla/sphinx/bin/searchd -c /www/webroot/logzilla/sphinx/sphinx.conf<br/></div></div><br/><br/><strong>七、配置Mysql</strong><br/><textarea name="code" class="sql" rows="15" cols="100">
# mysql -u<username> -p<password>
mysql> SELECT @@event_scheduler;
+-------------------+
&#124; @@event_scheduler &#124;
+-------------------+
&#124; OFF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;
+-------------------+
1 row in set (0.00 sec)
</textarea><br/>激活event_scheduler<br/><textarea name="code" class="sql" rows="15" cols="100">
mysql> SET GLOBAL event_scheduler = 1; 
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@event_scheduler;
+-------------------+
&#124; @@event_scheduler &#124;
+-------------------+
&#124; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;
+-------------------+
1 row in set (0.00 sec)
mysql> quit;
</textarea><br/><br/><strong>八、修改Syslog-ng配置</strong><br/><br/>v#i /opt/syslog-ng/etc/syslog-ng.conf<br/>(略)<br/><br/><strong>九、修改apache配置</strong><br/>#vi httpd.conf<br/><textarea name="code" class="c" rows="15" cols="100">
# LogZilla
&nbsp;&nbsp; Alias /logs "/www/webroot/logzilla/html/"
&nbsp;&nbsp; <Directory "/www/webroot/logzilla/html/">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Options Indexes MultiViews FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AllowOverride All
&nbsp;&nbsp; Order allow,deny
&nbsp;&nbsp; Allow from all
&nbsp;&nbsp; </Directory>
</textarea><br/>重启apache服务：/etc/init.d/apache2 restart<br/><br/><strong>十、IONCube授权</strong><br/>http://127.0.0.1/logs/login.php<br/><a href="https://blog.liuts.com/attachment.php?fid=137" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=137" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>下载源码包ioncube_loaders_lin_x86-64.tar.gz<br/><br/>#mkdir -p /usr/local/ioncube<br/>#tar -zxvf ioncube_loaders_lin_x86-64.tar.gz<br/>#cd ioncube<br/>#cp * /usr/local/ioncube/<br/>#vi /usr/local/php/lib/php.ini<br/>zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so<br/><br/>#/etc/init.d/apache2 restart<br/><br/><strong>十一、安装完毕</strong><br/>http://127.0.0.1/logs/login.php<br/>根据install.pl配置的管理员帐号密码进行登录。<br/>1、MainPage<br/><a href="https://blog.liuts.com/attachment.php?fid=138" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=138" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>2、StatPage<br/><a href="https://blog.liuts.com/attachment.php?fid=139" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=139" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><strong>十二、客户端配置</strong><br/>#vi /etc/syslog.conf<br/>在最后添加以下，其中syslog.admin.com.cn为主机域名，也可以直接用IP代替。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>*.emerg;*.err;*.warning&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @syslog.admin.com.cn<br/></div></div><br/>#/etc/init.d/syslog restart<br/><br/>测试：logger -p local4.err "This is a local.err test message."<br/><br/>参考文献：<br/><a href="http://nms.gdd.net/index.php/Install_Guide_for_LogZilla_v3.0" target="_blank">http://nms.gdd.net/index.php/Install_Guide_for_LogZilla_v3.0</a><br/><br/>如大家有什么疑问或感兴趣的话题可以通过weibo与我交流：<a href="http://t.qq.com/yorkoliu" target="_blank">http://t.qq.com/yorkoliu</a><br/>Tags - <a href="https://blog.liuts.com/tags/lamp/" rel="tag">lamp</a> , <a href="https://blog.liuts.com/tags/logzilla/" rel="tag">logzilla</a> , <a href="https://blog.liuts.com/tags/sphinx/" rel="tag">sphinx</a> , <a href="https://blog.liuts.com/tags/syslog-ng/" rel="tag">syslog-ng</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment103</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>城之内 &lt;realjia@gc73.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 23 Jul 2010 03:49:13 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment103</guid> 
<description>
<![CDATA[ 
	这个是在一台机器上管理所有机器上的日志吗？ 看的不是很明白，还是每台service上都要装这套系统！
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment104</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>healthly &lt;healthly@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 23 Jul 2010 09:10:21 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment104</guid> 
<description>
<![CDATA[ 
	十二、客户端配置 以下怎么看不懂呀？
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment105</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>healthly &lt;healthly@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 23 Jul 2010 09:33:19 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment105</guid> 
<description>
<![CDATA[ 
	那要是rsyslog可以用吗？
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment118</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>sisi &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 30 Jul 2010 02:56:07 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment118</guid> 
<description>
<![CDATA[ 
	[root@rhca scripts]# ./install.pl<br/>Can&#039;t locate Text/LevenshteinXS.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./install.pl line 29.<br/>BEGIN failed--compilation aborted at ./install.pl line 29
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment775</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>shine_forever &lt;shine_forever@yeah.net&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Jul 2011 03:36:16 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment775</guid> 
<description>
<![CDATA[ 
	请问这个软件大数据量时查询效率如何啊，我用cacti+syslog-ng方式，数据量达到5百万条以后，很慢了！！！！
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/207/#blogcomment2469</link>
<title><![CDATA[[评论] LAMP+logzilla+sphinx+syslog-ng实现集中日志管理(第一版)[原创]]]></title> 
<author>园林假山别墅 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 12 Aug 2014 13:07:36 +0000</pubDate> 
<guid>https://blog.liuts.com/post/207/#blogcomment2469</guid> 
<description>
<![CDATA[ 
	来了就留点下的记号，刘哥不要介意哦，呵呵
]]>
</description>
</item>
</channel>
</rss>