Enhanced Logging With rsyslog On Debian Etch And phpLogcon For Viewing
Enhanced Logging With rsyslog On Debian Etch And phpLogcon For ViewingWell everybody knows the issues of reading and searching in log files. If you have more than one machine it even gets worse. This tutorial describes how to install and configure rsyslog on Debian Etch, but it can be adapted to other distributions. Exerpt from rsyslog site: "Rsyslog, the enhanced syslogd for Linux and Unix. Rsyslog is an enhanced multi-threaded syslogd supporting, among others, MySQL, syslog/tcp, RFC 3195, permitted sender lists, filtering on any message part, and fine grain output format control. It is quite compatible to stock sysklogd and can be used as a drop-in replacement. Its advanced features make it suitable for enterprise-class, encryption protected syslog relay chains while at the same time being very easy to setup for the novice user. An optional web interface - phpLogCon - can be used to visualize all data online." In this tutorial we will be building rsyslog from source and write the necessary config files.
Step 1: See That The Necessary Tools Are Installedapt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev linux-kernel-headers lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++ mysql-server mysql-client libmysqlclient15-dev Next set a password for your mysql root user: mysqladmin -u root password your_mysqlroot_password Now we can create the rsyslog db: mysqladmin -u root -p create rsyslog Next we start the mysql command shell and create the rsyslog user: mysql -u root -p As you might have noticed we do not import any tables into the db. phpLogCon will do that for us.
Step 2: Get The rsyslog Source And Build rsyslogGet the source: cd /tmp Now let's build and install rsyslog: tar xvzf rsyslog-1.9.6.tar.gz Since rsyslog has no configuration examples (and files) I'll provide the examples here. All of these are just default configurations, use the documentation provided by rsyslog to customize the configuration to your specific needs. First the rsyslog configuration file /etc/rsyslog.conf. vi /etc/rsyslog.conf Just copy and paste the contents below: Do not forget to change the line: *.* >127.0.0.1,rsyslog,rsyslog_user,rsyslog_user_password with the username and password you specified above.
Next is the startup script /etc/init.d/rsyslog: vi /etc/init.d/rsyslog Just copy and paste the contents below:
Next we create a default configuration in /etc/default/rsyslogd: vi /etc/default/rsyslog Just copy and paste the contents below:
Next we create the directory /etc/rsyslog.d - this is needed for additional configuration options (not covered in the tutorial). mkdir /etc/rsyslog.d Now we have all of the configuration files, but we need now to make sure rsyslog is started at boot time in the right moment. Please note that rsyslog is not compatible with klogd and sysklogd which are installed by default. These need to be disabled or de-installed. In this tutorial I will disable them. Issue the following commands to start rsyslogd at the right time during system boot and to disable klogd and sysklogd. ln -s /etc/init.d/rsyslog /etc/rc3.d/S10rsyslog This concludes the build and configuration part.
Step 3: Install Apache2 And PHP5You can skip this if you have already installed apache2 and php5. apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert apt-get install 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 You will be asked the following question: Continue installing libc-client without Maildir support? <-- Yes
Step 4: Get phpLogCon And Install phpLogConcd /tmp Next we will create a directory for phpLogCon and enable it in Apache2: tar xvzf phplogcon-1.2.3.tar.gz Configure apache2 for phpLogcon: vi /etc/apache2/sites-enabled/your_site_conf Add the following alias to enable phplogcon: Alias /phplogcon "/var/www/phplogcon" Insert the line above before </virtualhost> or if you have already aliases defined, insert the line there. Note: if /var/www is your server root then you don't need to create an alias. Restart apache2 to enable the changes. /etc/init.d/apache2 force-reload
Step 5: Configure phpLogCon And Install The Tables In The rsyslog DBPoint your browser to http://yourdomain.tld/phplogcon and follow the steps on the screen. After the installation wizard has finished, the database is populated with all of the required tables and an administrative user is created. Delete the install directory to enable phpLogCon: rm -R /var/www/phplogcon/install
Step 6: Start rsyslogIssue the following commands to start rsyslog and to stop klogd and sysklogd: /etc/init.d/sysklogd stop
Step 7: Enjoy rsyslogPoint your browser to http://yourdomain.tld/phplogcon and log in with the username and password you specified in the installation wizard. You should now see something like this:
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning
Learn benefits of Simpana software.
View the Gartner Video








Recent comments
23 hours 51 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 10 hours ago
1 day 15 hours ago
1 day 15 hours ago
2 days 1 hour ago
2 days 4 hours ago
2 days 10 hours ago
2 days 12 hours ago