<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="http://info.routermonkey.org/styles/rss.css" type="text/css"?>
<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns="http://my.netscape.com/rdf/simple/0.9/"
>

 <channel>
  <title>www.routermonkey.org</title>
  <link>http://info.routermonkey.org/index.php?blogId=1</link>
  <description></description>
 </channel>
    <item>
   <title>Cisco PIX 7.2 logging to php-syslog-ng on linux RH FC4</title>
   <description>&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: 13.5pt; font-family: &#039;Courier New&#039;&quot;&gt;Cisco
PIX Syslog To PHP-Syslog-ng&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: 13.5pt; font-family: &#039;Courier New&#039;&quot;&gt;PIX
v7.2(2)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: 13.5pt; font-family: &#039;Courier New&#039;&quot;&gt;Barney
Gaumer &amp;ndash; 02/04/2008&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;Hopefully this document will help you to install/configure
and use PHP-Syslog-ng with your Pix to keep log history for security
infrastructure in a manageable format.&lt;/p&gt;



&lt;p class=&quot;MsoNormal&quot;&gt;Prerequisites:&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;Linux&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(preferably
RedHat FC4)&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;mySQL 4.x&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;Apache 2.x&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;PHP 5&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;Syslog-ng 1.6.x&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;PHP-Syslog-ng 2.8 or higher (I&amp;rsquo;m using 2.8)&lt;br /&gt;&lt;a href=&quot;http://downloads.sourceforge.net/php-syslog-ng/phpsyslogng-2.8.tar.gz?modtime=1120681704&amp;amp;big_mirror=0&quot;&gt;http://downloads.sourceforge.net/php-syslog-ng/phpsyslogng-2.8.tar.gz?modtime=1120681704&amp;amp;big_mirror=0&lt;/a&gt;&amp;nbsp;&lt;/p&gt;



&lt;p class=&quot;MsoNormal&quot;&gt;Starting off, if you don&amp;rsquo;t have all of the above mentioned
packages installed, you can use YUM on many linux distro&amp;rsquo;s to download and install
packages and their dependencies.&lt;/p&gt;





&lt;p class=&quot;MsoNormal&quot;&gt;Example:&lt;br /&gt;&lt;em&gt;yum install mysqld&lt;/em&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(this will install mysql
client and server)&lt;/p&gt;



&lt;p class=&quot;MsoNormal&quot;&gt;&lt;em&gt;yum install httpd&lt;/em&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(this will install Apache
web server)&lt;/p&gt;



&lt;p class=&quot;MsoNormal&quot;&gt;&lt;em&gt;yum install php-mysql&lt;/em&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(this will install PHP with mysql
support)&lt;/p&gt;



&lt;p class=&quot;MsoNormal&quot;&gt;&lt;em&gt;yum install syslog-ng&lt;/em&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(this will install syslog-ng)&lt;/p&gt;



&lt;p&gt;Now at the shell prompt on your linux box, type the following to automatically start mysqld, apache and syslog-ng.&lt;/p&gt;&lt;p&gt;chkconfig --levels 235 mysqld on&lt;br /&gt;chkconfig --levels 235 syslog-ng on&lt;br /&gt;chkconfig --levels 235 httpd on &lt;/p&gt;&lt;p&gt;This will set each service to start for run levels 2,3 and 5. &lt;strong&gt;Note:&lt;/strong&gt; If you have problems with syslog-ng writing to mysql, type chkconfig --levels 235 syslog-ng off to stop the /etc/init.d/syslog-ng itteration and start it in /etc/rc.local by adding the following:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;/sbin/syslog-ng&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Next, cd into
/etc/syslog-ng and using vi, edit &lt;strong&gt;syslog-ng.conf&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Comment out the following:&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&lt;strong&gt;# source s_sys {&lt;br /&gt;
&amp;nbsp; #&amp;nbsp; file (&amp;quot;/proc/kmsg&amp;quot; log_prefix(&amp;quot;kernel: &amp;quot;));&lt;br /&gt;
&amp;nbsp; #&amp;nbsp; unix-stream (&amp;quot;/dev/log&amp;quot;);&lt;br /&gt;
&amp;nbsp; #&amp;nbsp; unix-stream (&amp;quot;/etc/log/log&amp;quot;);&lt;br /&gt;
&amp;nbsp; #&amp;nbsp; internal();&lt;br /&gt;
&amp;nbsp; #&amp;nbsp; udp(ip(0.0.0.0) port(514));&lt;br /&gt;
&amp;nbsp; # };&lt;/strong&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;And comment out:&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;#log { source(s_sys); filter(f_filter1); destination(d_cons); };&lt;br /&gt;#log { source(s_sys); filter(f_filter2); destination(d_mesg); };&lt;br /&gt;#log { source(s_sys); filter(f_filter3); destination(d_auth); };&lt;br /&gt;#log { source(s_sys); filter(f_filter4); destination(d_mail); };&lt;br /&gt;#log { source(s_sys); filter(f_filter5); destination(d_mlal); };&lt;br /&gt;#log { source(s_sys); filter(f_filter6); destination(d_spol); };&lt;br /&gt;#log { source(s_sys); filter(f_filter7); destination(d_boot); };&lt;br /&gt;#log { source(s_sys); filter(f_filter8); destination(d_cron); };&lt;/div&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Then add the following:&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;destination d_mysql {&lt;/p&gt;









&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;pipe(&amp;quot;/var/log/mysql.pipe&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; template(&amp;quot;INSERT INTO logs&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(host, facility, priority, level, tag,
datetime, program, msg)&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VALUES ( &amp;#39;$HOST&amp;#39;, &amp;#39;$FACILITY&amp;#39;,
&amp;#39;$PRIORITY&amp;#39;, &amp;#39;$LEVEL&amp;#39;, &amp;#39;$TAG&amp;#39;, &amp;#39;$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC&amp;#39;,&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;$PROGRAM&amp;#39;, &amp;#39;$MSG&amp;#39; );n&amp;quot;)
template-escape(yes));&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;};&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;#&lt;span&gt;&amp;nbsp; &lt;/span&gt;};&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;log { source(net); destination(d_mysql);&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;/p&gt;





&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;source src {
unix-dgram(&amp;quot;/dev/log&amp;quot;); internal(); };&lt;br /&gt;#source src {
unix-dgram(&amp;quot;/etc/log/log&amp;quot;); internal(); };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source net { udp(); };&lt;/p&gt;

&lt;/div&gt;



&lt;p&gt;&lt;span style=&quot;color: #ff9900&quot;&gt;In this last implimentation, I had some trouble with the unix socket file /etc/log/log so I used the standard /dev/log which seemed to work fine? &amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Now tweak the destination&lt;span style=&quot;color: #000000&quot;&gt;/&lt;/span&gt;filters:&lt;/span&gt;&lt;/p&gt;

&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;















&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;destination d_cons {
file(&amp;quot;/dev/console&amp;quot;); };&lt;br /&gt;destination d_mesg {
file(&amp;quot;/var/log/messages&amp;quot;); };&lt;br /&gt;destination d_auth {
file(&amp;quot;/var/log/secure&amp;quot;); };&lt;br /&gt;destination d_mail {
file(&amp;quot;/var/log/maillog&amp;quot; sync(10)); };&lt;br /&gt;destination d_spol {
file(&amp;quot;/var/log/spooler&amp;quot;); };&lt;br /&gt;destination d_boot {
file(&amp;quot;/var/log/boot.log&amp;quot;); };&lt;br /&gt;destination d_cron {
file(&amp;quot;/var/log/cron&amp;quot;); };&lt;br /&gt;destination d_mlal {
usertty(&amp;quot;*&amp;quot;); };&lt;/p&gt;





















&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&amp;nbsp;&lt;br /&gt;#filter f_filter1&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(kern); };&lt;br /&gt;filter f_filter2&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ level(info..emerg) and&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;not facility(mail,authpriv,cron);
};&lt;br /&gt;filter f_filter3&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(authpriv); };&lt;br /&gt;filter f_filter4&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(mail); };&lt;br /&gt;filter f_filter5&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ level(emerg); };&lt;br /&gt;filter f_filter6&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(uucp) or&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span&gt;&lt;/span&gt;(facility(news) and
level(crit..emerg)); };&lt;br /&gt;filter f_filter7&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(local7); };&lt;br /&gt;filter f_filter8&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{ facility(cron); };&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Now you need to create a directory located in / called &lt;/span&gt;&lt;strong&gt;scripts&lt;br /&gt;&lt;em&gt;mkdir /scripts&lt;/em&gt;&lt;/strong&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;then cd into /scripts&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Create a file called&lt;/span&gt; &lt;strong&gt;syslog2mysql.sh&lt;/strong&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;by typing&lt;/span&gt; &lt;em&gt;&lt;strong&gt;vi syslog2mysql.sh&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;This is were we define the fifo file&lt;/span&gt; &lt;strong&gt;mysq.pipe&lt;/strong&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;that allows syslog-ng to write to your mysql database:&lt;/span&gt;&lt;/p&gt;

&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;





&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;#!/bin/bash&lt;/p&gt;













&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;if [ ! -e
/var/log/mysql.pipe ]&lt;br /&gt;then&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mkfifo /var/log/mysql.pipe&lt;br /&gt;fi&lt;br /&gt;while [ -e
/var/log/mysql.pipe ]&lt;br /&gt;do&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;mysql -u root --password=password&lt;span&gt;&amp;nbsp; &lt;/span&gt;syslog &amp;lt; /var/log/mysql.pipe &amp;gt;/dev/null&lt;br /&gt;done&lt;/p&gt;

&lt;/div&gt;&lt;p&gt;Make the directory &lt;strong&gt;phpsyslog&lt;/strong&gt; in &lt;strong&gt;/var/www/html&lt;/strong&gt;.&amp;nbsp; You should have downloaded &lt;strong&gt;phpsyslogng-2.8.tar.gz&lt;/strong&gt; to your system.&amp;nbsp; Copy the file to /var/www/html/phpsyslog.&amp;nbsp; CD into /var/www/html/phpsyslog and unpack &lt;strong&gt;phpsyslogng-2.8.tar.gz &lt;/strong&gt;by typing &lt;em&gt;&lt;strong&gt;tar zxvf phpsyslogng-2.8.tar.gz.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Now is a good time to setup the root password for mysql:&lt;/p&gt;&lt;p&gt;your-box# &lt;strong&gt;mysql -u root&lt;/strong&gt;&lt;br /&gt;mysql&amp;gt; &lt;strong&gt;SET PASSWORD FOR &amp;#39;root&amp;#39;@&amp;#39;localhost&amp;#39; = PASSWORD(&amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;PASSWD&lt;/span&gt;&amp;#39;&lt;span style=&quot;background-color: #ff0000&quot;&gt;&lt;/span&gt;);&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Whatever you changed the root password for mysql to is what you will most likely populate config.php db authentication parms with.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Ok - Now you need to CD into the directory /var/www/html/phpsyslog/scripts and run the following:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;mysql -u root -p password &amp;lt; ./dbsetup.sql&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;This will setup the syslog database in mysql.&amp;nbsp; If any of this &amp;quot;bonks&amp;quot; on you, type &lt;strong&gt;/etc/init.d/mysqld restart&lt;/strong&gt; just to make sure that mysql is running.&lt;/p&gt;&lt;p&gt;Now cd into /var/www/html/phpsyslog/config and edit the file config.php to change the database user, password and site URL:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;strong&gt;config.php&lt;/strong&gt;&lt;/p&gt;&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;

&lt;p class=&quot;MsoNormal&quot; style=&quot;border: medium none ; padding: 0in&quot;&gt;&amp;lt;?php&lt;br /&gt;// Copyright (C) 2005 Claus Lund, clauslund@gmail.com&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: MISC FUNCTIONALITY&lt;br /&gt;//========================================================================&lt;br /&gt;define(&amp;#39;PAGETITLE&amp;#39;, &amp;#39;php-syslog-ng&amp;#39;);&lt;br /&gt;define(&amp;#39;VERSION&amp;#39;, &amp;#39;2.8&amp;#39;);&lt;br /&gt;&lt;br /&gt;// COUNT_ROWS determines if results also display the number of total&lt;br /&gt;// entries in the query. You need to have MySQL 4.0.0 or later for this&lt;br /&gt;// to work. If you are using an older version of MySQL then disable this&lt;br /&gt;// feature.&lt;br /&gt;define(&amp;#39;COUNT_ROWS&amp;#39;, TRUE);&lt;br /&gt;&lt;br /&gt;// DEFAULTLOGTABLE is the name of the table where new syslog entries are&lt;br /&gt;// stored.&lt;br /&gt;define(&amp;#39;DEFAULTLOGTABLE&amp;#39;, &amp;#39;logs&amp;#39;);&lt;br /&gt;&lt;br /&gt;// MERGELOGTABLE is the name of the merge table. This feature should&lt;br /&gt;// generally only be used in combination with the logrotate script.&lt;br /&gt;// If it is enabled then the logrotate script will create a merge table&lt;br /&gt;// of all the log tables. Be aware that you need to be a little careful&lt;br /&gt;// when using merge tables so it is recommended that you only use it with&lt;br /&gt;// the logrotate script. The merge table will also be the one used to&lt;br /&gt;// populate the HOSTS and FACILITY fields on the search form.&lt;br /&gt;define(&amp;#39;MERGELOGTABLE&amp;#39;, &amp;#39;all_logs&amp;#39;);&lt;br /&gt;&lt;br /&gt;// If LOGROTATERETENTION is defined then it determines how many days logs&lt;br /&gt;// are kept. Old log tables with a datestamp older than LOGROTATERETENTION&lt;br /&gt;// days will be dropped.&lt;br /&gt;define(&amp;#39;LOGROTATERETENTION&amp;#39;, 90);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: MISC FUNCTIONALITY&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: DATABASE CONNECTION INFO&lt;br /&gt;//========================================================================&lt;br /&gt;// DBUSER is the name of the basic user.&lt;br /&gt;define(&amp;#39;DBUSER&amp;#39;, &amp;#39;root&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBUSERPW is DBUSER&amp;#39;s database password.&lt;br /&gt;define(&amp;#39;DBUSERPW&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;password&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBADMIN is the name of the admin user.&lt;br /&gt;define(&amp;#39;DBADMIN&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;root&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBADMINPW is DBADMIN&amp;#39;s database password.&lt;br /&gt;define(&amp;#39;DBADMINPW&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;password&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBNAME is the name of the database you are using.&lt;br /&gt;define(&amp;#39;DBNAME&amp;#39;, &amp;#39;syslog&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBHOST is the host where the MySQL server is running.&lt;br /&gt;define(&amp;#39;DBHOST&amp;#39;, &amp;#39;localhost&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBPORT is the port where the MySQL server is listening.&lt;br /&gt;// The default port is 3306.&lt;br /&gt;define(&amp;#39;DBPORT&amp;#39;, &amp;#39;3306&amp;#39;);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: DATABASE CONNECTION INFO&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: AUTHENTICATION&lt;br /&gt;//========================================================================&lt;br /&gt;define(&amp;#39;REQUIRE_AUTH&amp;#39;, TRUE);&lt;br /&gt;define(&amp;#39;AUTHTABLENAME&amp;#39;, &amp;#39;users&amp;#39;);&lt;br /&gt;&lt;br /&gt;// Authentication has two modes:&lt;br /&gt;// 1) You renew the session on every page view. This means you can have a&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; tail screen running and the session will never expire as long as you&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; refresh the screen before SESSION_EXP_TIME. This is the default.&lt;br /&gt;// 2) The session is timed from the time you login. The session is only&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; refreshed on login.&lt;br /&gt;define(&amp;#39;RENEW_SESSION_ON_EACH_PAGE&amp;#39;, TRUE);&lt;br /&gt;&lt;br /&gt;// SESSION_EXP_TIME is seconds until the session expires.&lt;br /&gt;define(&amp;#39;SESSION_EXP_TIME&amp;#39;, &amp;#39;3600&amp;#39;);&lt;br /&gt;&lt;br /&gt;// Set the URL to php-syslog-ng. If you don&amp;#39;t then the login screen will&lt;br /&gt;// not be able to redirect users automatically after a successful login.&lt;br /&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;define(&amp;#39;URL&amp;#39;, &amp;#39;http://172.20.1.7/phpsyslog/&amp;#39;);&lt;/span&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// END: AUTHENTICATION&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: ACCESS CONTROL&lt;br /&gt;//========================================================================&lt;br /&gt;// Access Control Lists allows you to specify what individual users have&lt;br /&gt;// access to. Access Control requires Authentication to have any effect.&lt;br /&gt;&amp;lt;?php&lt;br /&gt;// Copyright (C) 2005 Claus Lund, clauslund@gmail.com&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: MISC FUNCTIONALITY&lt;br /&gt;//========================================================================&lt;br /&gt;define(&amp;#39;PAGETITLE&amp;#39;, &amp;#39;php-syslog-ng&amp;#39;);&lt;br /&gt;define(&amp;#39;VERSION&amp;#39;, &amp;#39;2.8&amp;#39;);&lt;br /&gt;&lt;br /&gt;// COUNT_ROWS determines if results also display the number of total&lt;br /&gt;// entries in the query. You need to have MySQL 4.0.0 or later for this&lt;br /&gt;// to work. If you are using an older version of MySQL then disable this&lt;br /&gt;// feature.&lt;br /&gt;define(&amp;#39;COUNT_ROWS&amp;#39;, TRUE);&lt;br /&gt;&lt;br /&gt;// DEFAULTLOGTABLE is the name of the table where new syslog entries are&lt;br /&gt;// stored.&lt;br /&gt;define(&amp;#39;DEFAULTLOGTABLE&amp;#39;, &amp;#39;logs&amp;#39;);&lt;br /&gt;&lt;br /&gt;// MERGELOGTABLE is the name of the merge table. This feature should&lt;br /&gt;// generally only be used in combination with the logrotate script.&lt;br /&gt;// If it is enabled then the logrotate script will create a merge table&lt;br /&gt;// of all the log tables. Be aware that you need to be a little careful&lt;br /&gt;// when using merge tables so it is recommended that you only use it with&lt;br /&gt;// the logrotate script. The merge table will also be the one used to&lt;br /&gt;// populate the HOSTS and FACILITY fields on the search form.&lt;br /&gt;define(&amp;#39;MERGELOGTABLE&amp;#39;, &amp;#39;all_logs&amp;#39;);&lt;br /&gt;&lt;br /&gt;// If LOGROTATERETENTION is defined then it determines how many days logs&lt;br /&gt;// are kept. Old log tables with a datestamp older than LOGROTATERETENTION&lt;br /&gt;// days will be dropped.&lt;br /&gt;define(&amp;#39;LOGROTATERETENTION&amp;#39;, 90);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: MISC FUNCTIONALITY&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: DATABASE CONNECTION INFO&lt;br /&gt;//========================================================================&lt;br /&gt;// DBUSER is the name of the basic user.&lt;br /&gt;define(&amp;#39;DBUSER&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;root&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBUSERPW is DBUSER&amp;#39;s database password.&lt;br /&gt;define(&amp;#39;DBUSERPW&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;password&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBADMIN is the name of the admin user.&lt;br /&gt;define(&amp;#39;DBADMIN&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;root&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBADMINPW is DBADMIN&amp;#39;s database password.&lt;br /&gt;define(&amp;#39;DBADMINPW&amp;#39;, &amp;#39;&lt;span style=&quot;color: #ff0000&quot;&gt;password&lt;/span&gt;&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBNAME is the name of the database you are using.&lt;br /&gt;define(&amp;#39;DBNAME&amp;#39;, &amp;#39;syslog&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBHOST is the host where the MySQL server is running.&lt;br /&gt;define(&amp;#39;DBHOST&amp;#39;, &amp;#39;localhost&amp;#39;);&lt;br /&gt;&lt;br /&gt;// DBPORT is the port where the MySQL server is listening.&lt;br /&gt;// The default port is 3306.&lt;br /&gt;define(&amp;#39;DBPORT&amp;#39;, &amp;#39;3306&amp;#39;);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: DATABASE CONNECTION INFO&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: AUTHENTICATION&lt;br /&gt;//========================================================================&lt;br /&gt;define(&amp;#39;REQUIRE_AUTH&amp;#39;, TRUE);&lt;br /&gt;define(&amp;#39;AUTHTABLENAME&amp;#39;, &amp;#39;users&amp;#39;);&lt;br /&gt;&lt;br /&gt;// Authentication has two modes:&lt;br /&gt;// 1) You renew the session on every page view. This means you can have a&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; tail screen running and the session will never expire as long as you&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; refresh the screen before SESSION_EXP_TIME. This is the default.&lt;br /&gt;// 2) The session is timed from the time you login. The session is only&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; refreshed on login.&lt;br /&gt;define(&amp;#39;RENEW_SESSION_ON_EACH_PAGE&amp;#39;, TRUE);&lt;br /&gt;&lt;br /&gt;// SESSION_EXP_TIME is seconds until the session expires.&lt;br /&gt;define(&amp;#39;SESSION_EXP_TIME&amp;#39;, &amp;#39;3600&amp;#39;);&lt;br /&gt;&lt;br /&gt;// Set the URL to php-syslog-ng. If you don&amp;#39;t then the login screen will&lt;br /&gt;// not be able to redirect users automatically after a successful login.&lt;br /&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;define(&amp;#39;URL&amp;#39;, &amp;#39;http://172.20.1.7/phpsyslog/&amp;#39;);&lt;/span&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// END: AUTHENTICATION&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: ACCESS CONTROL&lt;br /&gt;//========================================================================&lt;br /&gt;// Access Control Lists allows you to specify what individual users have&lt;br /&gt;// access to. Access Control requires Authentication to have any effect.&lt;br /&gt;// Currently only the Configure screen uses this options.&lt;br /&gt;define(&amp;#39;USE_ACL&amp;#39;, TRUE);&lt;br /&gt;define(&amp;#39;USER_ACCESS_TABLE&amp;#39;, &amp;#39;user_access&amp;#39;);&lt;br /&gt;define(&amp;#39;ACTION_TABLE&amp;#39;, &amp;#39;actions&amp;#39;);&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: ACCESS CONTROL&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: SEARCH CACHE&lt;br /&gt;//========================================================================&lt;br /&gt;// Enabling the search cache will create a small table with the values&lt;br /&gt;// needed to fill in the HOSTS and FACILITY fields on the search page.&lt;br /&gt;// The cache table has to filled/updated by either clicking the refresh&lt;br /&gt;// cache option or periodically running the updateCache.php script (from&lt;br /&gt;// cron).&lt;br /&gt;// If you use the MERGELOGTABLE then the cache will be updated using that&lt;br /&gt;// table. If you do not use MERGELOGTABLE then the cache is updated for&lt;br /&gt;// each table with log data.&lt;br /&gt;define(&amp;#39;USE_CACHE&amp;#39;, TRUE);&lt;br /&gt;define(&amp;#39;CACHETABLENAME&amp;#39;, &amp;#39;search_cache&amp;#39;);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: SEARCH CACHE&lt;br /&gt;//========================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//========================================================================&lt;br /&gt;// BEGIN: REG EXP ARRAY USED FOR INPUT VALIDATION&lt;br /&gt;//========================================================================&lt;br /&gt;$regExpArray = array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;username&amp;quot;=&amp;gt;&amp;quot;(^w{4,}$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;password&amp;quot;=&amp;gt;&amp;quot;(^.{4,}$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;pageId&amp;quot;=&amp;gt;&amp;quot;(^w+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;sessionId&amp;quot;=&amp;gt;&amp;quot;(^w{32}$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;date&amp;quot;=&amp;gt;&amp;quot;/^yesterday$|^today$|^now$|^(d){4}-([01]*d)-([0123]*d)$/i&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;time&amp;quot;=&amp;gt;&amp;quot;/^now$|^([012]*d):([012345]*d):([012345]*d)$/i&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;limit&amp;quot;=&amp;gt;&amp;quot;(^d+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;orderby&amp;quot;=&amp;gt;&amp;quot;/^seq$|^host$|^facility$|^priority$|^datetime$/i&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;order&amp;quot;=&amp;gt;&amp;quot;/^asc$|^desc$/i&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;offset&amp;quot;=&amp;gt;&amp;quot;(^d+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;collapse&amp;quot;=&amp;gt;&amp;quot;/^1$/&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;table&amp;quot;=&amp;gt;&amp;quot;(^w+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;excludeX&amp;quot;=&amp;gt;&amp;quot;(^[01]$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;host&amp;quot;=&amp;gt;&amp;quot;(^[w-.]+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;facility&amp;quot;=&amp;gt;&amp;quot;(^w+$)&amp;quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;priority&amp;quot;=&amp;gt;&amp;quot;/^debug$|^info$|^notice$|^warning$|^err$|^crit$|^alert$|^emerg$/i&amp;quot;,&lt;br /&gt;);&lt;br /&gt;//========================================================================&lt;br /&gt;// END: REG EXP ARRAY USED FOR INPUT VALIDATION&lt;br /&gt;//========================================================================&lt;br /&gt;?&amp;gt;&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now it&amp;#39;s time to login to ASDM to setup and define syslog server and rate limiting.&amp;nbsp; Important Note: If you don&amp;#39;t set a rate limit for&amp;nbsp; notices on your Pix, your syslog-ng/mysql WILL get pounded!&lt;/p&gt;&lt;p&gt;Let&amp;#39;s start off in Configuration &amp;gt; Properties &amp;gt; Logging &amp;gt; Logging Setup&lt;/p&gt;&lt;p&gt;Check the check boxes for &amp;quot;enable sysloging&amp;quot; and &amp;quot;send logs in EMBLEM format.&amp;nbsp; EMBLEM format is compatible with standard unix style syslog servers and syslog-ng.&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_227&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-setup.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-setup.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Now move down to &amp;quot;Configuration &amp;gt; Properties &amp;gt; Logging &amp;gt; Logging Filters&amp;quot; Click on the Syslog Servers item and choose edit&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_221&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-filters.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-filters.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;In syslog from all event classes, click the radio button for filter on severity and select informational from the list&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_220&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-filters%28detail%29.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-filters%28detail%29.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Next move to &amp;quot;Configuration &amp;gt; Properties &amp;gt; Logging &amp;gt; Rate Limit&amp;quot; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;a id=&quot;res_224&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-rate_limit.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-rate_limit.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;in the section &amp;quot;Rate Limits for Syslog Logging Levels&amp;quot; click on informational and choose edit&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_222&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-rate_limit%28detail%29.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-rate_limit%28detail%29.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;I&amp;#39;m being fairly conservative, sending 100 Informational messages every five seconds.&amp;nbsp; Next, move to &amp;quot;Configuration &amp;gt; Properties &amp;gt; Logging &amp;gt; Syslog Servers&amp;quot; Choose ADD.&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_225&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-logging-servers%28detail%29.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-logging-servers%28detail%29.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Choose the approprate firewall interface and enter the IP Address of your syslog server, select udp/514 then click OK.&amp;nbsp; Now move to &amp;quot;Configuration &amp;gt; Properties &amp;gt; Logging &amp;gt; Syslog Setup&amp;quot; choose &amp;quot;Local7&amp;quot; as the facility code&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_229&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-syslog-setup.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-syslog-setup.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Click on the Advanced button to make changes to Device ID if desired&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_228&quot; href=&quot;http://info.routermonkey.org/gallery/1/properties-syslog-setup%28advanced%29.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/properties-syslog-setup%28advanced%29.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Now type the following in a terminal window on your syslog server:&lt;/p&gt;&lt;p&gt;/etc/init.d/mysqld restart&lt;/p&gt;&lt;p&gt;/etc/init.d/httpd restart&lt;/p&gt;&lt;p&gt;/sbin/syslog-ng &amp;amp;&lt;/p&gt;&lt;p&gt;/scripts/syslog2mysql.sh &amp;amp;&lt;/p&gt;&lt;p&gt;Make sure that the last two are in /etc/rc.local&lt;/p&gt;&lt;p&gt;rc.local&amp;nbsp;&lt;/p&gt;&lt;div style=&quot;border: 1pt solid windowtext; padding: 1pt 4pt&quot;&gt;#!/bin/sh&lt;br /&gt;#&lt;br /&gt;# This script will be executed *after* all the other init scripts.&lt;br /&gt;# You can put your own initialization stuff in here if you don&amp;#39;t&lt;br /&gt;# want to do the full Sys V style init stuff.&lt;br /&gt;&lt;br /&gt;touch /var/lock/subsys/local&lt;br /&gt;/sbin/syslog-ng&lt;br /&gt;/bin/bash /scripts/syslog2mysql.sh&lt;/div&gt;

&lt;span style=&quot;color: #0000ff&quot;&gt; &lt;/span&gt;&lt;p&gt;Now launch your browser and type in the URL to php-syslog-ng, you should see something similar to the following:&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_234&quot; href=&quot;http://info.routermonkey.org/gallery/1/phpsyslog-ng.screenshot-sanitized.JPG&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org/gallery/1/previews-med/phpsyslog-ng.screenshot-sanitized.JPG&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large; color: #ff0000&quot;&gt;Doc under construction!&lt;/span&gt;&lt;br /&gt; &lt;/p&gt;</description>
   <link>http://info.routermonkey.org/index.php?op=ViewArticle&amp;articleId=14&amp;blogId=1</link>
      <pubDate>Mon, 04 Feb 2008 15:21:41 -0600</pubDate>   
  </item>
    <item>
   <title>mini HowTo on getting a RANCID implementation on it feet</title>
   <description>&lt;p class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: 13.5pt; font-family: Arial&quot;&gt;RANCID - Really Awesome New Cisco confIg Differ&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;This is a mini HowTo on getting a RANCID implementation on it feet, for complete documentation please visit&lt;span&gt;&amp;nbsp; &lt;/span&gt;the official website for RANCID found @ &lt;a href=&quot;http://www.shrubbery.net/rancid/&quot;&gt;http://www.shrubbery.net/rancid/&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Download the package at &lt;a href=&quot;ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.1.tar.gz&quot;&gt;ftp://ftp.shrubbery.net/pub/rancid/rancid-2.3.1.tar.gz&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;You will want to run this on BSD or some flavor of Linux.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;Dependencies:&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style=&quot;font-size: 12pt; font-family: &#039;Times New Roman&#039;&quot;&gt;Expect needs to be installed, try &amp;ldquo;yum -y install expect&amp;rdquo;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;rancid will also need to have the following packages:&lt;/pre&gt;cvs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code revision system available from prep.ai.mit.edu:/pub/gnu&lt;br /&gt;gnudiff&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gnudiff provides the uni-diff (-u) option.&amp;nbsp; If you do not have&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a diff that supports -u, configure will set-up rancid to use&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;diff -c&amp;#39; or &amp;#39;diff -C&amp;#39;.&lt;br /&gt;perl5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; perl version 5 or greater available from www.cpan.org&lt;br /&gt;expect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://expect.nist.gov/&amp;nbsp; We highly suggest that you stick to&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expect 5.24.1 (or so).&amp;nbsp; This seems to work best.&amp;nbsp; Note that&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; you need to have the accompanying tcl &amp;amp;/ tk.&lt;br /&gt;svn&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code revision system, an alternative to cvs.&amp;nbsp; Available from&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http://subversion.tigris.org/tarballs/.&amp;nbsp; Use the configure&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; option --enable-svn to configure for Subversion.&lt;br /&gt;tcl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Required by expect.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;strong&gt;Lets get started!&lt;/strong&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;Drop the gzipped tarball into /opt and untar it using &amp;ldquo;tar zxvf rancid-2.3.1.tar.gz&amp;rdquo;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Cd to the directory where rancid was extracted and read the install and readme files.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;Then execute:&lt;/strong&gt;&lt;/p&gt;&lt;pre&gt;[root@mybox rancid-2.3.x]# ./configure --prefix=/usr/local/rancid/&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Then type make &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Then make install&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;I&amp;rsquo;m just running this as root &amp;ndash; I know, shame on me but I just wanted it up fast!&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Edit the file /usr/local/rancid/etc/rancid.conf&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;(I am using SVN for the repo so I changed &amp;quot;RCSSYS=svn; export RCSSYS&lt;em&gt;&amp;quot;) &lt;/em&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;em&gt;here is what mine looks like&lt;/em&gt;&lt;/p&gt;&lt;p&gt;# rancid 2.3.2a6&lt;br /&gt;# This file sets up the environment used for rancid.&amp;nbsp; see rancid.conf(5)&lt;br /&gt;#&lt;br /&gt;# This will be site specific&lt;br /&gt;#&lt;br /&gt;TERM=network;export TERM&lt;br /&gt;#&lt;br /&gt;# Create files w/o world read/write/exec permissions, but read/exec permissions&lt;br /&gt;# for group.&lt;br /&gt;umask 027&lt;br /&gt;#&lt;br /&gt;# Under BASEDIR (i.e.: --localstatedir), there will be a &amp;quot;logs&amp;quot; directory for&lt;br /&gt;# the logs from rancid and a directory for each group of routers defined in&lt;br /&gt;# LIST_OF_GROUPS (below).&amp;nbsp; In addition to these, there will be a &amp;quot;CVS&amp;quot;&lt;br /&gt;# directory which is the cvs (or Subversion) repository.&lt;br /&gt;#&lt;br /&gt;# Use a full path (no sym-links) for BASEDIR.&lt;br /&gt;#&lt;br /&gt;TMPDIR=/tmp; export TMPDIR&lt;br /&gt;# Be careful changing this, it affects CVSROOT below.&lt;br /&gt;BASEDIR=/usr/local/rancid/var; export BASEDIR&lt;br /&gt;PATH=/usr/local/rancid/bin:/usr/bin:/usr/sbin:.:/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin; export PATH&lt;br /&gt;# Location of the CVS/SVN repository.&amp;nbsp; Be careful changing this.&lt;br /&gt;CVSROOT=$BASEDIR/CVS; export CVSROOT&lt;br /&gt;# Location of log files produced by rancid-run(1).&lt;br /&gt;LOGDIR=$BASEDIR/logs; export LOGDIR&lt;br /&gt;#&lt;br /&gt;# Select which RCS system to use, &amp;quot;cvs&amp;quot; (default) or &amp;quot;svn&amp;quot;.&amp;nbsp; Do not change&lt;br /&gt;# this after CVSROOT has been created with rancid-cvs.&amp;nbsp; Changing between these&lt;br /&gt;# requires manual conversions.&lt;br /&gt;#RCSSYS=cvs; export RCSSYS&lt;br /&gt;&lt;em&gt;&lt;strong&gt;RCSSYS=svn; export RCSSYS&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;#&lt;br /&gt;# if NOPIPE is set, temp files will be used instead of a cmd pipe during&lt;br /&gt;# collection from the router(s).&lt;br /&gt;#NOPIPE=YES; export NOPIPE&lt;br /&gt;#&lt;br /&gt;# FILTER_PWDS determines which passwords are filtered from configs by the&lt;br /&gt;# value set (NO | YES | ALL).&amp;nbsp; see rancid.conf(5).&lt;br /&gt;#FILTER_PWDS=YES; export FILTER_PWDS&lt;br /&gt;#&lt;br /&gt;# if NOCOMMSTR is set, snmp community strings will be stripped from the configs&lt;br /&gt;#NOCOMMSTR=YES; export NOCOMMSTR&lt;br /&gt;#&lt;br /&gt;# How many times failed collections are retried (for each run) before&lt;br /&gt;# giving up.&amp;nbsp; Minimum: 1&lt;br /&gt;#MAX_ROUNDS=4; export MAX_ROUNDS&lt;br /&gt;#&lt;br /&gt;# How many hours should pass before complaining about routers that&lt;br /&gt;# can not be reached.&amp;nbsp; The value should be greater than the number&lt;br /&gt;# of hours between your rancid-run cron job.&lt;br /&gt;OLDTIME=4; export OLDTIME&lt;br /&gt;#&lt;br /&gt;# How many hours should pass before complaining that a group&amp;#39;s collection&lt;br /&gt;# (the age of it&amp;#39;s lock file) is hung.&lt;br /&gt;#LOCKTIME=4; export LOCKTIME&lt;br /&gt;#&lt;br /&gt;# The number of devices to collect simultaneously.&lt;br /&gt;#PAR_COUNT=5; export PAR_COUNT&lt;br /&gt;#&lt;br /&gt;# list of rancid groups&lt;br /&gt;LIST_OF_GROUPS=&amp;quot;ISI_Prod_Routers ISI_Prod_Switchgear ISI_Prod_Firewalls ISI_ATM_Backbone ISI_Lab_Routers ISI_Lab_Switchgear ISI_Lab_Firewalls&amp;quot;&lt;br /&gt;# more groups...&lt;br /&gt;#LIST_OF_GROUPS=&amp;quot;$LIST_OF_GROUPS noc billybobisp&amp;quot;&lt;br /&gt;#&lt;br /&gt;# For each group, define a list of people to receive the diffs.&lt;br /&gt;# in sendmail&amp;#39;s /etc/aliases.&lt;br /&gt;#&amp;nbsp;&amp;nbsp; rancid-group:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notoriousBG@isiisi.com&lt;br /&gt;#&amp;nbsp;&amp;nbsp; rancid-admin-group: notoriousBG@isiisi.com&lt;br /&gt;# be sure to read ../README regarding aliases.&lt;br /&gt;#&lt;br /&gt;# If your MTA configuration is broken or you want mail to be forwarded to a&lt;br /&gt;# domain not the same the local one, define that domain here.&amp;nbsp; &amp;quot;@&amp;quot; must be&lt;br /&gt;# included, as this is simply appended to the usual recipients.&amp;nbsp; It is NOT&lt;br /&gt;# appended to recipients specified in rancid-run&amp;#39;s -m option.&lt;br /&gt;# MAILDOMAIN=&amp;quot;@isiisi.com&amp;quot;; export MAILDOMAIN&lt;br /&gt;#&lt;br /&gt;# By default, rancid mail is marked with precedence &amp;quot;bulk&amp;quot;.&amp;nbsp; This may be&lt;br /&gt;# changed by setting the MAILHEADERS variable; for example no header by setting&lt;br /&gt;# it to &amp;quot;&amp;quot; or adding X- style headers.&amp;nbsp; Individual headers must be separated&lt;br /&gt;# by a \n.&lt;br /&gt;MAILHEADERS=&amp;quot;&amp;quot;; export MAILHEADERS&lt;/p&gt;&lt;p&gt;Run the rancid-cvs command to create the /usr/local/var/networking directory and its database and network device list files.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Creat the file &amp;quot;/root/.cloginrc&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;strong&gt;Example:&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;[root@blzsfed60bg ~]# cat .cloginrc &lt;br /&gt;#Routers&lt;br /&gt;add password * consolepass enablepass&lt;/p&gt;&lt;p&gt;Now, there is a file called Router.db located in each group directory, for me that location is:&lt;/p&gt;&lt;p&gt;/usr/local/rancid/var&lt;/p&gt;&lt;p&gt;&lt;strong&gt;My groups are:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;ISI_ATM_Backbone&lt;br /&gt;ISI_Lab_Firewalls&lt;br /&gt;ISI_Lab_Routers&lt;br /&gt;ISI_Lab_Switchgear&lt;br /&gt;ISI_Prod_Firewalls&lt;br /&gt;ISI_Prod_Routers&lt;br /&gt;ISI_Prod_Switchgear&lt;/p&gt;&lt;p&gt;You can call them whatever you want - that was done in the rancid.conf.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below is a sample of one of my Router.db files&amp;nbsp;&lt;/p&gt;&lt;p&gt;[root@blzsfed60bg ISI_Lab_Routers]# cat router.db &lt;br /&gt;10.10.107.1:cisco:up&lt;br /&gt;10.10.107.2:cisco:up&lt;br /&gt;172.30.100.26:cisco:up&lt;br /&gt;[root@blzsfed60bg ISI_Lab_Routers]#&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;Here is my crontab for the root user, you can see that rancid is schedule to run every hour.&lt;/p&gt;&lt;p&gt;&amp;nbsp;[root@blzsfed60bg etc]# crontab -l&lt;br /&gt;*/1 * * * * /scripts/cacti_poller.sh &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;1 * * * * /usr/local/rancid/bin/rancid-run &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;50 23 * * * /usr/bin/find /usr/local/rancid/var/logs -type f -mtime +2 -exec rm {} \;&lt;br /&gt;[root@blzsfed60bg etc]# &lt;/p&gt;&lt;p&gt;make sure you start SVN by issuing the command &amp;quot;/usr/bin/svnserve -d&amp;quot;&lt;/p&gt;&lt;p&gt;Download Tortoise SVN client and install it on the computer you will access the repo from.&lt;/p&gt;&lt;p&gt;&amp;nbsp;To access your REPO - right click on your desktop, you should see the following:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://info.routermonkey.org//gallery/1/tortoisSVN.GIF&quot; border=&quot;0&quot; width=&quot;434&quot; height=&quot;325&quot; /&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;Click on Repo-browser an you see the following:&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://info.routermonkey.org//gallery/1/tortoisSVN-url.GIF&quot; border=&quot;0&quot; width=&quot;416&quot; height=&quot;280&quot; /&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;Type in the path to your REPO and click OK, you should see something similar to the following:&lt;/p&gt;&lt;p&gt;(note - I have right clicked on 7.7.7.3 and selected &amp;quot;Log Messages&amp;quot; in the screenshot below)&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;a id=&quot;res_12&quot; href=&quot;http://info.routermonkey.org//gallery/1/tortoisSVN-browser.GIF&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org//gallery/1/previews-med/tortoisSVN-browser.GIF&quot; border=&quot;0&quot; width=&quot;527&quot; height=&quot;480&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp; Right click on the Modified item and choose &amp;quot;Show didderences&amp;quot; You well see a diff such as the following:&lt;/p&gt;&lt;p&gt;&lt;a id=&quot;res_13&quot; href=&quot;http://info.routermonkey.org//gallery/1/tortoisSVN-diff.GIF&quot;&gt;&lt;img src=&quot;http://info.routermonkey.org//gallery/1/previews-med/tortoisSVN-diff.GIF&quot; border=&quot;0&quot; width=&quot;640&quot; height=&quot;453&quot; /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;There you have it!&lt;/p&gt;&lt;p&gt;Disclamer - If you want detailed instruction on setting up rancid, you should go to: &amp;nbsp; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a href=&quot;http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch1_:_Network_Backups_With_Rancid&quot; target=&quot;_blank&quot;&gt;http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch1_:_Network_Backups_With_Rancid&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Peter Harrison&lt;/strong&gt; has done a great job of putting this information together and his howto is great.&lt;/p&gt;&lt;p&gt;Also, I have some troubleshooting notes @ &lt;a href=&quot;http://forums.routermonkey.org&quot; target=&quot;_blank&quot;&gt;forums.routermonkey.org&lt;/a&gt; regarding the mail function of Rancid.&amp;nbsp;&lt;/p&gt;</description>
   <link>http://info.routermonkey.org/index.php?op=ViewArticle&amp;articleId=5&amp;blogId=1</link>
      <pubDate>Fri, 17 Aug 2007 11:33:57 -0500</pubDate>   
  </item>
  </rdf:RDF>

