471,337 Members | 1,115 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

php-syslog-ng: Help needed desperately...

Has anybody seen this tool? It is awesome. check out
http://vw.vermeer.org/ . It's a php front end for large-scale syslog
deployments. It makes managing syslog in large networks a snap.

The idea is to fifo pipe network syslog into a MySQL database backend.
The php scripts reference the database, and print stuff to the screen.

My Info -> RH9.0 , MySQL 4.0.14, apache1.3.28

I have successfully gotten everything installed, compiled, etc. The
syslog is going to the MySQL database quite nicely. The problem, is
that retreivals are failing completely. When I try to do a search in
the database, I get the following errors...


Warning: Unknown(/usr/local/apache/htdocs/results.php): failed to open
stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening
'/usr/local/apache/htdocs/results.php' for inclusion
(include_path='.:/usr/local/lib/php') in Unknown on line 0

I am happy to post my phpinfo(); if necessary. Everything is pretty
much right out of the box. I am happy to send screenshots if needed...

My pear list is
[root@localhost bin]# pear list
Installed packages:
Package Version State
Archive_Tar 0.9 stable
Console_Getopt 1.0 stable
DB 1.3 stable
HTTP 1.2 stable
Mail 1.0.1 stable
Net_SMTP 1.0 stable
Net_Socket 1.0.1 stable
PEAR 1.1 stable
XML_Parser 1.0.1 stable
XML_RPC 1.0.4 stable
Lastly, I thought I would just post the results.php script... I'm no
programmer, and I can't figure out what reference is failing.

thanks for all your help. I will personally send a cookie to whoever
helps me solve this problem.

Erich Trowbridge



| Copyright (C) 2002 Michael Earls


| This program is free software; you can redistribute it and/or

| modify it under the terms of the GNU General Public License

| as published by the Free Software Foundation; either version 2

| of the License, or (at your option) any later version.


| This program is distributed in the hope that it will be useful,

| but WITHOUT ANY WARRANTY; without even the implied warranty of


| GNU General Public License for more details.


| php-syslog-ng: php4 mysql syslog-ng


| This code is currently maintained and debugged by Michael Earls, any

| questions or comments regarding this code should be directed to:

| - mi*****@michaelearls.com


| - vermeer - http://www.vermeer.org/


Network Syslog Search Results
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link type="text/css" href="results.css" rel="stylesheet"/>
<!-- <img src="/images/logo"></a> -->
<h2>Network Syslog Monitor</h2>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" height="20">
<td nowrap><small>INFO</small></td>
<td bgcolor="#C1FFC1" width="20" align="center">DEBUG</td>
<td bgcolor="#CAFF70" width="20" align="center">NOTICE</td>
<td bgcolor="#FFFFOO" width="20" align="center">WARNING</td>
<td bgcolor="#FFA500" width="20" align="center">ERR</td>
<td bgcolor="#FF4500" width="20" align="center">CRIT</td>
<td bgcolor="#FF0000" width="20" align="center">ALERT</td>
<b><font size="2">SEVERITY LEGENED</font></b>
<a href="index.php">Search</a>


MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to
connect to the database");
@mysql_select_db( "$dbName") or die( "Unable to select database");

// begin script

if (isset ($_POST['host'])) { $host = $_POST['host'];
if (isset ($_POST['priority'])) { $priority =
$_POST['priority']; }
if (isset ($_POST['date'])) { $date = $_POST['date'];
if (isset ($_POST['limit'])) { $limit =
$_POST['limit']; }
if (isset ($_GET['host'])) { $host = $_GET['host']; }
if (isset ($_GET['priority'])) { $priority =
$_GET['priority']; }
if (isset ($_GET['date'])) { $date = $_GET['date']; }
if (isset ($_GET['limit'])) { $limit = $_GET['limit'];
if (isset ($_GET['offset'])) { $offset =
$_GET['offset']; }
else {
$offset = 1;

$where = "";
$query = "SELECT * FROM logs";
$where = "host='".$host."' ";
if($where!="") $where = $where." AND ";
$where = $where." priority='".$priority."'
if($where !="") $where = $where." AND ";
$where = $where." date='".$date."' ";
if($where !="")
$query = $query." WHERE ".$where." ORDER BY
time AND date";
$query = $query." ORDER BY time AND date";

$result = mysql_query($query);
$num_results = mysql_num_rows($result);

$query .= " limit ".$offsettemp.", ".$limit;
$results = mysql_query($query);

echo "<i>Number of Syslog Entries</i>: <b>".$num_results." </b>";

echo "<div align=center>";
echo "<table border=1 width=100%>";
echo "<tr bgcolor=silver>";
echo "<td><b><font color=blue>Seq</b></td>";
echo "<td><b><font color=blue>Host</b></td>";
echo "<td><b><font color=blue>Priority</b></td>";
echo "<td><B><font color=blue>Date</b></td>";
echo "<td><B><font color=blue>Time</b></td>";
echo "<td><B><font color=blue>Message</b></td>";
echo "</tr>";

while ($row = mysql_fetch_array($results))
echo "<tr>";
echo "<td>$row[seq]</td>";
echo "<td>$row[host]</td>";
if ($row[priority] == "alert") { echo "<td
bgcolor=\"#FF0000\"><center>$row[priority]</center></td>"; }
elseif ($row[priority] == "crit") { echo "<td
bgcolor=\"#FF4500\"><center>$row[priority]</center></td>"; }
elseif ($row[priority] == "err") { echo "<td
bgcolor=\"#FFA500\"><center>$row[priority]</center></td>"; }
elseif ($row[priority] == "warning") { echo "<td
bgcolor=\"#FFFFOO\"><center>$row[priority]</center></td>"; }
elseif ($row[priority] == "notice") { echo "<td
bgcolor=\"#CAff70\"><center>$row[priority]</center></td>"; }
elseif ($row[priority] == "debug") { echo "<td
bgcolor=\"#C1FFC1\"><center>$row[priority]</center></td>"; }
// elseif ($row[priority] == "info") { echo "<td
bgcolor=\"#C1FFC1\"><center>$row[priority]</center></td>"; }
else {
echo "<td><center>$row[priority]</center></td>"; }
echo "<td>$row[date]</td>";
echo "<td>$row[time]</td>";
echo "<td>".htmlspecialchars($row[msg])."</td>";
echo "</tr>";

echo "</table>";
echo "<hr>";
echo "Result Page:&nbsp;&nbsp;&nbsp;&nbsp;";

if ($offset!=1) { // bypass PREV link if offset is 0
$prevoffset=$offset-$limit ;
print "<a href=\"$PHP_SELF?offset=$prevoffset&host=$host&pri ority=$priority&date=$date&limit=$limit\">PREV</a>
&nbsp; \n";


if ($num_results%$limit) {

for ($i=1;$i<=$pages;$i++) {
if ((intval($offset/$limit)+1)==$i )
print "<font size=+1>$i</font>&nbsp; \n";
print "<a href=\"$PHP_SELF?offset=$newoffset&host=$host&prio rity=$priority&date=$date&limit=$limit\">$i</a>
&nbsp; \n";

if (!(intval($offset/$limit)+1==$pages) && $pages!=1) {
// not last page so give NEXT link
print "<a href=\"$PHP_SELF?offset=$newoffset&host=$host&prio rity=$priority&date=$date&limit=$limit\">NEXT</a>
&nbsp; \n";
<a href="index.php">Search</a>
Jul 16 '05 #1
1 2799

The problem was that corrcet permissions were not set on the
results.php file. For the archives, make sure that the correct
permissions exist on the php files. I had copied everything out of the
archive, so it was all owned by user root with 644 permissions, save
for results.php, which was 600. I set the permissions to 644 and
everything works great.

Now I just have to figure out how to not make the plaintext
dbinfo.inc.php globally readable and I'll be set.

Erich Trowbridge
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by lawrence | last post: by
9 posts views Thread by Bartosz Wegrzyn | last post: by
4 posts views Thread by Japhy | last post: by
59 posts views Thread by Lennart Björk | last post: by
8 posts views Thread by Marcel | last post: by
1 post views Thread by jdurden | last post: by
1 post views Thread by ansc1 | last post: by
reply views Thread by tsivaraman | last post: by
reply views Thread by Benjamin Grieshaber | last post: by
4 posts views Thread by mechphisto | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.