473,223 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,223 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...

http://localhost/results.php

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

<?php
/*

+-------------------------------------------------------------------------+

| 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
|

| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|

| 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/
|

+-------------------------------------------------------------------------+

*/
?>
<html>
<head>
<title>
Network Syslog Search Results
</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<link type="text/css" href="results.css" rel="stylesheet"/>
</head>
<!-- <img src="/images/logo"></a> -->
<br>
<h2>Network Syslog Monitor</h2>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" height="20">
<tr>
<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>
</tr>
</table>
</div>
<a href="index.php">Search</a>
<hr>
<body>
<?php

include("dbinfo.inc.php");

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;
}

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

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

$offsettemp=$offset-1;
$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";
}

$pages=intval($num_results/$limit);

if ($num_results%$limit) {
$pages++;
}

for ($i=1;$i<=$pages;$i++) {
$newoffset=$limit*($i-1)+1;
if ((intval($offset/$limit)+1)==$i )
print "<font size=+1>$i</font>&nbsp; \n";
else
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
$newoffset=$offset+$limit;
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>
<br>
<br>
</body>
Jul 16 '05 #1
1 2916
<snip>

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: lawrence | last post by:
I haven't been able to reach www.php.net for days. Most of the rest of the web is working for me, though I've bad trouble reaching any English sites. Anyone else having trouble?
9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
59
by: Lennart Bjrk | last post by:
Hi All, I have a tiny program: <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MyTitle</title> <meta...
8
by: Marcel | last post by:
I have a problem with a PHP page that seems to get executed twice. I am running PHP5 ISAPI on 2003 server. The script is a PHP page with a form. When the form is submitted one record have to...
1
by: jdurden | last post by:
am currently woking on building this site: www.maverick-spirit.com. everything seems to be fine except the press releases page. When you click on one of the press releases in the left column under...
1
by: ansc1 | last post by:
Hello, I'm new to using php coding. I need help with the following: 1. There is a submit button on the form and is saves information to my database. After clicking on "Save Measurement" it...
0
by: tsivaraman | last post by:
I am trying to build php-5.2.1 in RedHat Linux 9. I have installed libxml2-2.6.11,mysql-5.0.33,httpd-2.2.4(apache) successfully.When i do 'make' from the php directory,i get the following...
0
by: Benjamin Grieshaber | last post by:
Hi, I´m on SuSE 9.3 with xmlrpc-c and xmlrpc-c-devel installed (ver. 0.9.10) I tried to compile php with xmlrpc support and got the following errors: ...
4
by: mechphisto | last post by:
I'm working on a friend's box, Fedora Core 6. It has PHP 5.1.6. I need to install mcrypt into it, and the only way I can find to do it is from source then recompile PHP. So I did all that, and got...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.