<?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/209/</link>
<title><![CDATA[LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>刘天斯 &lt;liutiansi@gmail.com&gt;</author>
<category><![CDATA[Linux]]></category>
<pubDate>Sat, 24 Jul 2010 06:28:52 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/</guid> 
<description>
<![CDATA[ 
	<strong>一、前言</strong><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 为什么要引入第二版？由于<a href="http://blog.liuts.com/post/207/" target="_blank">第一版</a>是基于Logzilla3.0，作者在Logzilla3.0以后做了licensed限制，可以从作者回复邮件的内容得到证实[图1]。因此需要定期去更新license.txt来达到延长使用期限的目的，个人感觉比较麻烦，同时还有主机及日志数的限制，这也是整理第二版的原因，当然，你也可以通过以下途径获取免费、无限制的licensed，见<a href="http://forum.logzilla.info/index.php?topic=214.0" target="_blank">How to get a free, unlimited, license of LogZilla</a>。但这不是本文所要讨论的话题：），第二版中本人采用logzilla2.9.9版来搭建一个免费、无限制的日志集中管理平台，功能上与3.0差异不大，好了，废话少说，我们开始吧！<br/><div align=center>[图1]</div><br/><a href="https://blog.liuts.com/attachment.php?fid=143" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=143" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><strong>平台截图</strong><br/><a href="https://blog.liuts.com/attachment.php?fid=141" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=141" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="https://blog.liuts.com/attachment.php?fid=142" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=142" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><strong>二、平台初始化</strong><br/>部署LAMP平台(略)<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>#yum install libdbi* libnet<br/>#cpan Date::Calc Text::LevenshteinXS String::CRC32<br/>#cpan -i Digest::SHA1<br/>#cpan -i Net::MySQL<br/></div></div><br/><strong>三、下载相关包</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><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/></div></div><br/><strong>四、开始安装</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><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/></div></div><br/><strong>五、安装logzilla</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>#cd /www/webroot/<br/>#wget http://php-syslog-ng.googlecode.com/files/logzilla_v2.9.9o.tgz<br/>#tar xzvf logzilla_v2.9.9o.tgz<br/>#mkdir -p /var/log/logzilla<br/></div></div><br/><strong>六、配置Mysql</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/># mysql -u<username> -p<password><br/>mysql> SELECT @@event_scheduler;<br/>+-------------------+<br/>&#124; @@event_scheduler &#124;<br/>+-------------------+<br/>&#124; OFF&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;<br/>+-------------------+<br/>1 row in set (0.00 sec)<br/></div></div><br/><br/><span style="color: #FF0000;">低于Mysql5.1版本会提示如下，如不打算升级到logzilla3.0，没有关系，可以略过此步骤。</span><br/>mysql> SELECT @@event_scheduler;<br/>ERROR 1193 (HY000): Unknown system variable 'event_scheduler'<br/><br/>激活event_scheduler<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>mysql> SET GLOBAL event_scheduler = 1; <br/>Query OK, 0 rows affected (0.00 sec)<br/><br/>mysql> SELECT @@event_scheduler;<br/>+-------------------+<br/>&#124; @@event_scheduler &#124;<br/>+-------------------+<br/>&#124; ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;<br/>+-------------------+<br/>1 row in set (0.00 sec)<br/><br/>mysql> quit;<br/></div></div><br/><strong>七、修改Syslog-ng配置</strong><br/>#vi /opt/syslog-ng/etc/syslog-ng.conf<br/><textarea name="code" class="c" rows="15" cols="100">
@version: 3.0
source s_local &#123;
internal();
unix-stream("/dev/log");
file("/proc/kmsg" program_override("kernel: "));
&#125;;
source s_local &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;udp(ip(0.0.0.0) port(514));
&#125;;

# destinations
destination d_messages &#123; file("/var/log/messages"); &#125;;


###########################################################################################
# Clay's LogZilla config below
###########################################################################################
# Last updated on 2010-06-15
###########################################################################################
options &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long_hostnames(off);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# doesn't actually help on Solaris, log(3) truncates at 1024 chars
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log_msg_size(8192);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# buffer just a little for performance
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# sync(1); <- Deprecated - use flush_lines() instead
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flush_lines(1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# memory is cheap, buffer messages unable to write (like to loghost)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log_fifo_size(16384);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Hosts we don't want syslog from
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#bad_hostname("^(ctld.&#124;cmd&#124;tmd&#124;last)$");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# The time to wait before a dead connection is reestablished (seconds)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time_reopen(10);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#Use DNS so that our good names are used, not hostnames
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use_dns(yes);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dns_cache(yes);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#Use the whole DNS name
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use_fqdn(yes);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keep_hostname(yes);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chain_hostnames(no);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#Read permission for everyone
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;perm(0644);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# The default action of syslog-ng 1.6.0 is to log a STATS line
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# to the file every 10 minutes.&nbsp;&nbsp;That's pretty ugly after a while.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Change it to every 12 hours so you get a nice daily update of
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# # how many messages syslog-ng missed (0).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# stats(43200);
&#125;;

destination d_logzilla &#123;
&nbsp;&nbsp; program("/www/webroot/php-syslog-ng/scripts/db_insert.pl"
&nbsp;&nbsp; template("$HOST&#92;t$FACILITY&#92;t$PRIORITY&#92;t$LEVEL&#92;t$TAG&#92;t$YEAR-$MONTH-$DAY&#92;t$HOUR:$MIN:$SEC&#92;t$PROGRAM&#92;t$MSG&#92;n")
&nbsp;&nbsp; template_escape(yes)
&nbsp;&nbsp; );
&#125;;

# Tell syslog-ng to log to our new destination 
log &#123;
&nbsp;&nbsp; source(s_local);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;destination(d_logzilla);
&#125;;
</textarea><br/><strong>八、修改apache配置</strong><br/>#vi httpd.conf<br/><textarea name="code" class="c" rows="15" cols="100">
<VirtualHost *:80>
&nbsp;&nbsp;&nbsp;&nbsp;ServerAdmin liutiansi@gmail.com
&nbsp;&nbsp;&nbsp;&nbsp;DocumentRoot /www/webroot/php-syslog-ng/html/
&nbsp;&nbsp;&nbsp;&nbsp;ServerName syslog.com.cn
&nbsp;&nbsp;&nbsp;&nbsp;ErrorLog logs/syslog.com.cn-error_log
&nbsp;&nbsp;&nbsp;&nbsp;CustomLog logs/syslog.com.cn-access_log common
# LogZilla
Alias /logs "/www/webroot/php-syslog-ng/html/"
<Directory "/www/webroot/php-syslog-ng/html/">
&nbsp;&nbsp;&nbsp;&nbsp;Options Indexes MultiViews FollowSymLinks
&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride All
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allow from all
</Directory>
</VirtualHost>
</textarea><br/>重启apache服务：/etc/init.d/apache2 restart<br/><br/><strong>九、修改php.ini</strong><br/>Vi /usr/local/php/lib/php.ini<br/><textarea name="code" class="c" rows="15" cols="100">
memory_limit = 128M
max_execution_time = 300
/etc/init.d/apache2 restart
</textarea><br/><strong>十、配置日志分隔</strong><br/>cp /www/webroot/php-syslog-ng/scripts/contrib/system_configs/logrotate.d /etc/logrotate.d/logzilla<br/><br/><strong>十一、添加作业</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>@daily /usr/local/php/bin/php /www/webroot/php-syslog-ng/scripts/logrotate.php >> /var/log/php-syslog-ng/logrotate.log<br/>@daily /usr/bin/find /www/webroot/php-syslog-ng/html/jpcache/ -atime 1 -exec rm -f '&#123;&#125;' ';'<br/>0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/php/bin/php /www/webroot/php-syslog-ng/scripts/reloadcache.php >> /var/log/php-syslog-ng/reloadcache.log<br/></div></div><br/><strong>十二、开始平台安装</strong><br/># /etc/init.d/syslog-ng restart<br/>http://192.168.0.100/logs/来进行安装<br/>步骤如下：<br/><a href="http://nms.gdd.net/images/thumb/f/f7/Install001_pre-install-checklist.png/593px-Install001_pre-install-checklist.png" target="_blank"><img src="http://nms.gdd.net/images/thumb/f/f7/Install001_pre-install-checklist.png/593px-Install001_pre-install-checklist.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/1/16/Install002.png" target="_blank"><img src="http://nms.gdd.net/images/1/16/Install002.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/thumb/d/d9/Install003.png/509px-Install003.png" target="_blank"><img src="http://nms.gdd.net/images/thumb/d/d9/Install003.png/509px-Install003.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/6/6b/Install004.png" target="_blank"><img src="http://nms.gdd.net/images/6/6b/Install004.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/2/29/Install005.png" target="_blank"><img src="http://nms.gdd.net/images/2/29/Install005.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/4/4c/Install006.png" target="_blank"><img src="http://nms.gdd.net/images/4/4c/Install006.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/5/53/Install007.png" target="_blank"><img src="http://nms.gdd.net/images/5/53/Install007.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/a/ae/Install009.png" target="_blank"><img src="http://nms.gdd.net/images/a/ae/Install009.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><a href="http://nms.gdd.net/images/0/05/Install010.png" target="_blank"><img src="http://nms.gdd.net/images/0/05/Install010.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><strong>十三、替换脚本路径</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>cd /www/wewroot/php-syslog-ng/scripts<br/>./fixpaths.sh<br/></div></div><br/>或者直接用sed来修改<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>#sed -i -e "&#123; s@/path_to_logzilla@/www/webroot/php-syslog-ng@&#125;" *.*<br/></div></div><br/>＃/etc/init.d/syslog-ng restart<br/><br/><strong>十四、客户端配置</strong><br/>在最后添加以下，其中syslog.admin.com.cn为主机域名，也可以直接用IP代替。<br/>#vi /etc/syslog.conf<br/>*.emerg;*.err;*.warning&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @syslog.admin.com.cn<br/>#/etc/init.d/syslog restart<br/><br/>测试：logger -p local4.err "This is a local.err test message."<br/><br/><strong>十五、后续问题</strong><br/><strong><span style="color: #8B0000;">问题一</span>、点击[Graph]时会提示“JpGraph Error Font file </strong>"/usr/share/fonts/truetype/msttcorefonts/verdana.ttf" is not readable or does not exist.”<br/>解决方法：<br/>mkdir -p /usr/share/fonts/truetype/msttcorefonts/<br/>上传windows XP/2003/vista/下的字体文件verdana.ttf到/usr/share/fonts/truetype/msttcorefonts/即可。<br/><br/><strong><span style="color: #8B0000;">问题二</span>、logs表无数据，运行/www/webroot/php-syslog-ng/scripts/contrib/dbgen/dbgen.pl</strong><br/>提示：Cannot determine peer address at /usr/lib/perl5/site_perl/5.8.5/Net/MySQL.pm line 277 <br/><br/>解决方法：<br/>1、是logzilla2.9.9安装时一个bug，新建的mysql的syslogadmin、sysloguser用户权限没有成功赋予，手工添加上就OK了，感谢【杭州】FIGO提供的故障案例。<br/>2、如第1步不成功，尝试修改/www/webroot/php-syslog-ng/html/config/config.php文件mysql主机地址localhost为127.0.0.1。<br/><br/><strong><span style="color: #8B0000;">问题三</span>、搜索缓存图表只显示两天的数据，最近三天没有数据？</strong><br/>解决方法：<br/>由于search_cache表采用的是MEMORY存储引擎，有大小的限制，修改一下/etc/my.cnf，在[MYSQLD]添加：<br/>tmp_table_size=1G<br/>max_heap_table_size = 1G<br/>再重启mysql就可以了。<br/>效果图：<br/><a href="https://blog.liuts.com/attachment.php?fid=144" target="_blank"><img src="https://blog.liuts.com/attachment.php?fid=144" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><strong><span style="color: #8B0000;">问题四</span>、不能显示日志当中带有"<"、">"的问题，如思科系统的日志。</strong><br/>感谢[常州]老高提供的故障案例。<br/>解决方法：<br/>在tailresult.php和regularresult.php中查找<br/><textarea name="code" class="php" rows="15" cols="100">
if (CISCO_TAG_PARSE ) 
&nbsp;&nbsp; &#123;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$row['msg'] = preg_replace('/&#92;s:/', ':', $row['msg']);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$row['msg'] = preg_replace('/.*(%.*?:.*)/', '$1', $row['msg']);
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
</textarea><br/>在里面添加<br/><textarea name="code" class="php" rows="15" cols="100">
 $row['msg'] = preg_replace('/</', ' ', $row['msg']); 
 $row['msg'] = preg_replace('/>/', ' ', $row['msg']); 
</textarea><br/>即可。<br/><br/><strong><span style="color: #8B0000;">问题五</span>、客户端日志无法入库。</strong><br/>感谢[北京]永远飞扬提供的故障案例。<br/>系统环境：<br/>CentOS release 5.5 (Final) i386 2.6.18-194.el5<br/>LAMP （系统rpm默认安装）<br/>Mysql：5.0.77<br/>Php：PHP 5.1.6<br/>Apache：2.2.3<br/><br/>原因：<br/>perl for mysql驱动异常，直接采用bin/mysql+insert sql语句入库。<br/><br/>解决方法：<br/>#vi /opt/syslog-ng/etc/syslog-ng.conf<br/><textarea name="code" class="c" rows="15" cols="100">
@version: 3.0
#Default configuration file for syslog-ng.
#
# For a description of syslog-ng configuration file directives, please read
# the syslog-ng Administrator?ˉs guide at:
#
# http://www.balabit.com/dl/html/syslog-ng-admin-guide_en.html/bk01-toc.html
#
options &#123;
# Number of syslog lines stored in memory before being written to files
flush_lines (1); 
log_fifo_size (2048);
create_dirs (yes);
perm (0640);
dir_perm (0750);
keep_hostname (yes);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time_reopen (10);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log_fifo_size (1024);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long_hostnames (off);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use_dns (no);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use_fqdn (no);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; owner(root);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;group(root);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perm(0640);
&#125;; 
source s_network_1 &#123;
udp(ip(0.0.0.0) port(514));
&#125;;
destination d_network_1 &#123;
file("/var/log/syslog-ng/network/$YEAR.$MONTH.$DAY/$HOST/$FACILITY.log");
&#125;;
# Define the destination "d_network_1B" log directory
destination d_network_1B &#123;
file ("/var/log/syslog-ng/network/all/network.log");
&#125;;
log &#123;
source(s_network_1);
destination(d_network_1);
&#125;;
log &#123;
source(s_network_1);
destination(d_network_1B);
&#125;;
destination d_logzilla &#123;
program("/var/www/html/php-syslog-ng/scripts/db_insert.pl" 
template("$HOST&#92;t$FACILITY&#92;t$PRIORITY&#92;t$LEVEL&#92;t$TAG&#92;t$YEAR-$MONTH-$DAY&#92;t$HOUR:$MIN:$SEC&#92;t$PROGRAM&#92;t$MSG&#92;n"));
&#125;;#
log &#123;
source(s_network_1);
destination(d_logzilla);
&#125;;
source localhost_all &#123;
internal();
unix-stream("/dev/log");
file("/proc/kmsg" program_override("kernel"));
&#125;;
destination localhostlog &#123;
file ("/var/log/syslog-ng/$HOST/$YEAR-$MONTH/$DAY" create_dirs(yes));
&#125;;
log &#123;
source(localhost_all);
destination(localhostlog);
&#125;;
destination local_logzilla &#123;
program("/var/www/html/php-syslog-ng/scripts/db_insert.pl" 
template("$HOST&#92;t$FACILITY&#92;t$PRIORITY&#92;t$LEVEL&#92;t$TAG&#92;t$YEAR-$MONTH-$DAY&#92;t$HOUR:$MIN:$SEC&#92;t$PROGRAM&#92;t$MSG&#92;n"));
&#125;;
destination d_mysql &#123;
&nbsp;&nbsp;&nbsp;&nbsp;program("/usr/bin/mysql -usyslogadmin -psyslogadmin syslog"
&nbsp;&nbsp;&nbsp;&nbsp;template("INSERT INTO logs (host, facility, priority, level, tag, datetime, program, msg, seq)
&nbsp;&nbsp;&nbsp;&nbsp;VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$PROGRAM', '$MSG', '$SEQ' );&#92;n")
&nbsp;&nbsp;&nbsp;&nbsp;template-escape(yes));
&nbsp;&nbsp;&nbsp;&nbsp;&#125;;
log &#123;
source(localhost_all);
destination(local_logzilla);
&#125;;

</textarea><br/><span style="color: #FF0000;">*注：</span>配置中的相关参数需根据个人实际环境进行修改。<br/><br/><br/>全世界都在找logzilla_v2.9.9o.tgz包，打包线上的包放上来（修复原先一些小bug）<br/><a href="attachment.php?fid=340">点击这里下载文件</a><br/><br/>参考文献：<a href="http://nms.gdd.net/index.php/LogZilla_Installation_Guide" target="_blank">http://nms.gdd.net/index.php/LogZilla_Installation_Guide</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/logzilla/" rel="tag">logzilla</a> , <a href="https://blog.liuts.com/tags/syslog/" rel="tag">syslog</a> , <a href="https://blog.liuts.com/tags/syslog-ng/" rel="tag">syslog-ng</a> , <a href="https://blog.liuts.com/tags/%25E6%2597%25A5%25E5%25BF%2597/" rel="tag">日志</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment107</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>higkoo &lt;higkoo@tom.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 24 Jul 2010 07:12:46 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment107</guid> 
<description>
<![CDATA[ 
	弱问一下，这个系统的主要功能是什么？
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment108</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>kindle &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 24 Jul 2010 07:21:56 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment108</guid> 
<description>
<![CDATA[ 
	mark
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment114</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>godsoul &lt;godsoul1986@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 26 Jul 2010 09:09:29 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment114</guid> 
<description>
<![CDATA[ 
	@daily /usr/local/php/bin/php /www/webroot/php-syslog-ng/scripts/logrotate.php &gt;&gt; /var/log/php-syslog-ng/logrotate.log<br/>@daily /usr/bin/find /www/webroot/php-syslog-ng/html/jpcache/ -atime 1 -exec rm -f &#039;{}&#039; &#039;;&#039;<br/>0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/php/bin/php /www/webroot/php-syslog-ng/scripts/reloadcache.php &gt;&gt; /var/log/php-syslog-ng/reloadcache.log<br/>第一个问题 ＠daily是不是变量忽略了啊<br/>第二个问题&nbsp;&nbsp; 第二句的时候有错误！～
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment115</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>godsoul &lt;godsoul1986@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 26 Jul 2010 09:14:32 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment115</guid> 
<description>
<![CDATA[ 
	还有一个这个错误<br/>syntax error in /opt/syslog-ng/etc/syslog-ng.conf at line 2<br/>汗。做小白真不容易啊。。。
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment117</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 29 Jul 2010 11:14:35 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment117</guid> 
<description>
<![CDATA[ 
	我看别的文档都有libol-0.3.18.tar.gz 您的没有是不是说这个不用装了
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment119</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 30 Jul 2010 03:09:33 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment119</guid> 
<description>
<![CDATA[ 
	我用源码包编译的好像也没提示需要
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment123</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 02 Aug 2010 10:19:56 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment123</guid> 
<description>
<![CDATA[ 
	现在所有的服务都正常运行了~ 但是就是数据库无法得到客户机发来的数据而客户机发来按文件存放缺正常。并且我用了自带的测试脚本测试，数据库也可以正常接收，请问这个是什么问题呢？谢谢
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment124</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 02 Aug 2010 11:45:30 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment124</guid> 
<description>
<![CDATA[ 
	问题找到了，谢谢
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment127</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 03 Aug 2010 08:07:01 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment127</guid> 
<description>
<![CDATA[ 
	使用dbgen.pl测试完毕后，会发现实际情况可能取不到值，找来找去终于找到原来还是PERL库的问题，log插入数据库脚本运行测试# perl db_insert.pl 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/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at db_insert.pl line 22.BEGIN failed--compilation aborted at db_insert.pl line 22.[root@monitor scripts]# cpan -i Net::LevenshteinXS数据正常插入
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/209/#blogcomment128</link>
<title><![CDATA[[评论] LAMP+logzilla2.9.9+syslog-ng实现集中日志管理(第二版)[原创]]]></title> 
<author>prometheus &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 03 Aug 2010 08:08:32 +0000</pubDate> 
<guid>https://blog.liuts.com/post/209/#blogcomment128</guid> 
<description>
<![CDATA[ 
	我在其他的文章中以及自己测试过程中还发现一个问题帮你补充上吧~ 因为本人没BOLG所以没地方发，之前的GOOGLEDOC和FACEBOOK被封四、使用问题1、打开页面不能显示图形点击&quot;Graph&quot;的时候，报错：引用JpGraph Error Font file &quot;/usr/share/fonts/corefonts/verdana.ttf&quot; is not readable or does not exist.原因是，新版的php-syslog-ng考虑到旧版字库版权的问题，使用了verdana.ttf字库。而当前系统目录该字库。解决办法：1）从Windows\Fonts目录中拷贝到上述的路径即可；2）从安装包中下载，并放到上述目录下安装完毕后正常
]]>
</description>
</item>
</channel>
</rss>