All Linux HowTo's

Simple Rsyslog/MySQL Log Viewer in PHP

Share This:

log-sc2I’ve previously documented how to configure Rsyslog to store logs in MySQL which gives a good tutorial on setting up MySQL as the Rsyslog backend and also remote logging to that Rsyslog server. To extend on that, you can easily view and filter the logs using the php web-app below. The code below requires PHP 5.4 of newer (may work on newer but not tested).

Download the web-app here in PHP.

Download the file and change the name of it to something like “index.php”. It defaults to wanting access to the local MySQL server but you can point it to any MySQL server by editing the options sections.

$servername = "localhost";
$username = "sysloguser";
$password = "MySecretMySQLPassword";
$dbname = "Syslog";
$max_results = 200;
$logo = "http://www.agix.com.au/wp-content/uploads/2014/12/agix_black_1.png";
$title = "Log Filter Portal"; 

Leave a Reply

Your email address will not be published. Required fields are marked *