Syslog Priorities filtering

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
planman
Posts: 3
Joined: Tue Dec 01, 2009 4:45 am

Syslog Priorities filtering

Post by planman »

Hi :)

Im having some issues with the latest Cacti and syslog plugin.

I installed the latest CactiEZ with syslog plugin. Configured it to receive rsyslog and everything is working good, exept the filtering part.

From the beginning filtering on priorities did not work at all. Nothing showed up when i selected a priority.

I found this section of interest in syslog.php

<select name="elevel" onChange="javascript:document.getElementById('syslog_form').submit();" title="Priority Levels">
<option value="0"<?php if ($_REQUEST["elevel"] == "0") {?> selected<?php }?>>All Priorities</option>
<option value="1"<?php if ($_REQUEST["elevel"] == "1") {?> selected<?php }?>>Emergency</option>
<option value="2"<?php if ($_REQUEST["elevel"] == "2") {?> selected<?php }?>>Critical++</option>
<option value="2o"<?php if ($_REQUEST["elevel"] == "2o") {?> selected<?php }?>>Critical</option>
<option value="3"<?php if ($_REQUEST["elevel"] == "3") {?> selected<?php }?>>Alert++</option>
<option value="3o"<?php if ($_REQUEST["elevel"] == "3o") {?> selected<?php }?>>Alert</option>
and so on.....

I figured it would be something with it not finding the correct priorities in the database, so i had a look at the database:

mysql> select * from syslog_priorities;
+-------------+----------+---------------------+
| priority_id | priority | last_updated |
+-------------+----------+---------------------+
| 1 | 6 | 2013-05-14 13:54:22 |
| 2 | 3 | 2013-05-14 13:54:22 |
| 3 | 5 | 2013-05-14 13:54:22 |
| 4 | 4 | 2013-05-14 13:49:26 |
| 5 | 7 | 2013-01-25 11:53:08 |
| 6 | 2 | 2013-05-14 13:19:25 |
| 7 | 1 | 2013-05-14 13:53:21 |
| 8 | notice | 2013-07-23 16:11:40 |
| 9 | info | 2013-07-23 16:12:41 |
| 10 | err | 2013-07-23 16:12:41 |
| 11 | debug | 2013-07-23 16:01:39 |
| 12 | warn | 2013-07-23 16:12:41 |
| 13 | alert | 2013-07-23 16:12:41 |
| 14 | crit | 2013-07-23 15:04:39 |
| 15 | warning | 2013-07-21 15:04:32 |
| 16 | emerg | 2013-07-20 22:39:34 |
+-------------+----------+---------------------+

sure enough I found that the priority number was wrong. i changed them to the following:

<select name="elevel" onChange="javascript:document.getElementById('syslog_form').submit();" title="Priority Levels">
<option value="0"<?php if ($_REQUEST["elevel"] == "0") {?> selected<?php }?>>All Priorities</option>
<option value="16"<?php if ($_REQUEST["elevel"] == "16") {?> selected<?php }?>>Emergency</option>
<option value="14"<?php if ($_REQUEST["elevel"] == "14") {?> selected<?php }?>>Critical++</option>
<option value="14o"<?php if ($_REQUEST["elevel"] == "14o") {?> selected<?php }?>>Critical</option>
<option value="13"<?php if ($_REQUEST["elevel"] == "13") {?> selected<?php }?>>Alert++</option>
<option value="13o"<?php if ($_REQUEST["elevel"] == "13o") {?> selected<?php }?>>Alert</option>
<option value="10"<?php if ($_REQUEST["elevel"] == "10") {?> selected<?php }?>>Error++</option>
<option value="10o"<?php if ($_REQUEST["elevel"] == "10o") {?> selected<?php }?>>Error</option>
<option value="15"<?php if ($_REQUEST["elevel"] == "15") {?> selected<?php }?>>Warning++</option>
<option value="15o"<?php if ($_REQUEST["elevel"] == "15o") {?> selected<?php }?>>Warning</option>
<option value="12"<?php if ($_REQUEST["elevel"] == "12") {?> selected<?php }?>>Warn++</option>
<option value="12o"<?php if ($_REQUEST["elevel"] == "12o") {?> selected<?php }?>>Warn</option>
<option value="8"<?php if ($_REQUEST["elevel"] == "8") {?> selected<?php }?>>Notice++</option>
<option value="8o"<?php if ($_REQUEST["elevel"] == "8o") {?> selected<?php }?>>Notice</option>
<option value="9"<?php if ($_REQUEST["elevel"] == "9") {?> selected<?php }?>>Info++</option>
<option value="9o"<?php if ($_REQUEST["elevel"] == "9o") {?> selected<?php }?>>Info</option>
<option value="11"<?php if ($_REQUEST["elevel"] == "11") {?> selected<?php }?>>Debug</option>

Now i can filter successfully, however the ++ filters are not working correctly. Of course this has to do with the ordering of the priorities and the >= functionality of the ++ variants of priorities values.

Can anybody help me figure out how to fix this and reorder the database or reconstruct the sql queries so that the ++ functionality works as intended again?
ikorzha758
Cacti User
Posts: 164
Joined: Thu Jan 21, 2010 8:41 pm

Re: Syslog Priorities filtering

Post by ikorzha758 »

I had the same problem. my suggestion not to touch the syslog.php and import my .sql file to make all working... ++ works too
Attachments
syslog.zip
.sql and syslog.php to user in conjunction with it.
(12.53 KiB) Downloaded 230 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests