apt-get upgrade
apt-get install rsyslog rsyslog-mysql unzip zip binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libpcre3 libpopt-dev lynx m4 make ncftp nmap openssl perl perl-modules zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ mysql-server mysql-client libmysqlclient15-dev apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libdb4.6-dev libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
/etc/init.d/mysql restart
/etc/init.d/apache2 restart
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 415/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 581/apache2
GRANT SELECT, INSERT, UPDATE, DELETE ON rsyslog.* TO 'rsyslog'@'localhost' IDENTIFIED BY 'ENTER-YOUR-NEW-RSYSLOG-PASSWORD-HERE';
FLUSH PRIVILEGES;
quit
*.* >127.0.0.1,rsyslog,rsyslog,ENTER-YOUR-NEW-RSYSLOG-PASSWORD-HERE
#
# 想了解更多信息,请参阅/usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
$ModLoad MySQL
*.* >127.0.0.1,rsyslog,rsyslog,ENTER-YOUR-NEW-RSYSLOG-PASSWORD-HERE
#################
#### 模块 ####
#################
$ModLoad imuxsock # 提供对本地系统日志的支持
$ModLoad imklog # 提供内核日志支持(以前由rklogd来提供)
#$ModLoad immark # 提供--MARK--息功能
# 提供UDP syslog接收
#$ModLoad imudp
#$UDPServerRun 514
# 提供TCP syslog接收
$ModLoad imtcp
$InputTCPServerRun 514
###########################
#### 全局指令 ####
###########################
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 618/rsyslogd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 415/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 581/apache2
wget http://download.adiscon.com/loganalyzer/loganalyzer-3.4.1.tar.gz
tar xvzf loganalyzer-3.4.1.tar.gz
mv loganalyzer-3.4.1/ /var/www/
cd /var/www
cd contrib/
cp * ./../src/
cd ./../src/
sh ./configure.sh
#$ModLoad imtcp
#$InputTCPServerRun 514
$WorkDirectory /rsyslog/work # work(spool)文件的默认位置
$ActionQueueType LinkedList # 使用异步处理
$ActionQueueFileName srvrfwd # 设置文件名称,还启用磁盘模式
$ActionResumeRetryCount -1 # 插入失败后,无限次重试
$ActionQueueSaveOnShutdown on # 如果rsyslog关闭,保存内存中数据
*.* @@YOUR-RSYSLOG-SERVER-ADDRESS-HERE
###########################
#### 全局指令####
###########################
并重启rsyslog服务。
/etc/init.d/rsyslog restart
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.0.100:49188 192.168.0.15:514 ESTABLISHED 13289/rsyslogd
原文链接:http://www.howtoforge.com/centralized-rsyslog-server-monitoring