Install RSYSLOG & LogAnalyzer on CentOS 6-5
I am looking at rsyslog which is fast syslog system and Loganalyzer as an upfront web GUI for those logs. The Loganalyzer application offers searching of various syslogs, all of which is open source and available to download. In this guide I will go through the steps to get these two applications to work together and in the end of this tutorial we should have a working syslog system ready to take logs! The operating system I am using is the latest CentOS 6.5 minimal. Let's get started.
Using VMware Workstation the first thing I have done is installed a minimal version of CentOS on the VM. The VM has 30GB on the disk with one processor and two cores with 2GB of RAM. (Which took about 10 minutes to install) Once the VM rebooted I login into the root account and ran the command yum update and accepted all the updates the operating system was able to find (Which took about 10 minutes) Let’s first added some housekeeping packages like wget and nano yum install wget nano .The minimal install does not include wget, or nano. Nano is a good text editor for people who don’t want to use VI :) I have also disabled iptables (service iptables stop & chkconfig iptables off ) in this demo but this is not recommend in a production environment.
FIRST:
Let’s install apache:
yum install httpd
service httpd start
chkconfig httpd on

SECOND:
Install MySQL:
yum install mysql mysql-server
service mysqld start
chkconfig mysqld on
mysqladmin -u root password 'YourNewPassword'
mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
THRID:
Install PHP,
yum install php php-mysql php-gd
nano /var/www/html/test.php
<?php
phpinfo();
?>
service httpd restart

FOURTH:
Install Rsyslog, A couple things first, CentOS uses an older version of rsyslog, so why not use the latest stable version of rsyslog.
wget http://rpms.adiscon.com/v8-stable/rsyslog.repo
mv rsyslog.repo /etc/yum.repos.d/rsyslog.repo
yum install rsyslog\* --skip-broken
chkconfig rsyslog on
nano /usr/share/doc/rsyslog-mysql-8.2.1/createDB.sql
CREATE DATABASE rsyslogdb;
USE rsyslogdb;
CREATE TABLE SystemEvents
[...]
mysql -u root -p < /usr/share/doc/rsyslog-mysql-8.2.1/createDB.sql
mysql -u root -p rsyslogdb
GRANT ALL ON rsyslogdb.* TO rsyslogdbadmin@localhost IDENTIFIED BY 'NewPasswordHere';
FLUSH PRIVILEGES;
exit
mysql -u rsyslogdbadmin -p rsyslogdb\
# Provides UDP syslog reception
# for parameters see http://www.rsyslog.com/doc/imudp.html
module(load="imudp") # needs to be done just once
input(type="imudp" port="514")
# Provides TCP syslog reception
# for parameters see http://www.rsyslog.com/doc/imtcp.html
module(load="imtcp") # needs to be done just once
input(type="imtcp" port="514")
# Load the MySQL Module
module(load="ommysql")
#### RULES ####
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
*.emerg*
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
# ### begin forwarding rule ###
# Let's forward all logs to the MySQL Database
*.* :ommysql:127.0.0.1,rsyslogdb,rsyslogdbadmin,YourPassword
…
service rsyslog restart
mysql -u rsyslogdbadmin -p rsyslogdb
mysql> select count(*) from SystemEvents;
+----------+
| count(*) |
+----------+
| 2 |
+----------+
FIFTH:
Download the LogAnalyzer web application,
wget http://download.adiscon.com/loganalyzer/loganalyzer-3.6.5.tar.gz
tar zxvf loganalyzer-3.6.5.tar.gz
cp -r loganalyzer-3.6.5/src/ /var/www/html/loganalyzer
cp -r loganalyzer-3.6.5/contrib/\* /var/www/html/loganalyzer/
cd /var/www/html/loganalyzer/
chmod +x configure.sh secure.sh
[root@localhost \]# ./configure.sh
- Loganalyzer will do a couple of tests to verify configuration click next to start them.
- Select Next if the config.php file can be written.
- In the Basic Configuration use the following image below to reference your installation.
- The next page is to create tables in the MySQL database go ahead and select next.
- The next page displays any errors if any SQL Results failed, select next if you don't have any failed statements.
- In step 6 we create a main user account to log into the LogAnalyzer web app.
- In step 7, we create our source for syslog messages, follow the image below for a reference.
- Looks like we are done the select the "here" link to go to the login page.
Done! Some last things to check with LogAnalyzer is it does DNS lookups of IP address which can slow down the website if you have a lot of IPs in your logs. To disable that feature go to Admin Center ->Uncheck Resolve IP Addresses using DNS.
I have personally pushed up to 500 syslog messages every 10 seconds thanks to the Kiwi Syslog Generator and did not see any performance hits other than the DNS issue. Hope this information is helpful, let me know if you have used LogAnalyzer in a production environment, are there any gotchas? I have just been testing it on my lab and so far so good.
Links: CentOS MySQL RSYSLOG LogAnalyzer