如何将syslogng的日志写入MySQL数据库
<!-- content -->
<noscript><div class="greet_block"><div class="greet_text"><div class="greet_image"><a href="http://21nw.com/feed/rss/" rel="nofollow"><img src="http://21nw.com/wp-content/plugins/wp-greet-box/images/rss_icon.png" alt="WP Greet Box icon"/></a></div>Hello there! If you are new here, you might want to <a href="http://21nw.com/feed/rss/" rel="nofollow"><strong>subscribe to the RSS feed</strong></a> for updates on this topic.<div style="clear:both"></div><div class="greet_block_powered_by"><a href="http://omninoggin.com/projects/wordpress-plugins/wp-greet-box-wordpress-plugin/" title="WP Greet Box WordPress Plugin">Powered by WP Greet Box</a></div><div style="clear:both"></div></div></div></noscript>
在
使用syslog-ng搭建日志服务器
中已经讲了如何将syslog-ng配置为中心日志服务器,下面介绍如何将syslogng的日志写入mysql数据库,
系统:Gentoo-2007
1、修改/etc/syslog-ng/syslog-ng.conf,添加
source s_remote {
udp(ip(0.0.0.0) port(514));
};
destination r_mysql {
program(”/usr/bin/mysql -usyslogadmin -psyslogadmin syslog
log { source(s_remote); destination(r_mysql); };
2、建立mysql.pipe文件按
#mkfifo /var/log/mysql.pipe
3、重新启动syslog-ng
#/etc/init.d/syslog-ng restart
这种方法如果结合phpsyslogng一起使用,就可以在浏览器中对日志进行进一步的过滤和查看,非常方便,官方网站地址是:
http://code.google.com/p/php-syslog-ng/
http://nms.gdd.net/index.php/PHP-Syslog-NG