Cacti / plugin_syslog

Syslog Plugin for Cacti
GNU General Public License v2.0
21 stars 16 forks source link

Removal rule not using correct DB when using $use_cacti_db = false; #107

Closed stevemorgan83 closed 4 years ago

stevemorgan83 commented 4 years ago

Everything has been working great with the syslog plugin until I created a removal rule to delete messages that begin with "- - state_table_event; table=NTP; Event=Clock Updated;"

2020/01/17 11:11:05 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog.php[101]:syslog_messages(), /plugins/syslog/syslog.php[1532]:get_syslog_messages(), /plugins/syslog/syslog.php[837]:sql_hosts_where(), /plugins/syslog/functions.php[591]:db_fetch_cell_prepared(), /lib/database.php[378]:db_execute_prepared()) 2020/01/17 11:11:05 - CMDPHP ERROR: A DB Cell Failed!, Error: Table 'cacti.syslog_hosts' doesn't exist

I'm not using the cacti DB. I'm using a separate DB named 'syslog'

$use_cacti_db = false; $syslogdb_default = 'syslog';

[root@work cacti]# sudo -u apache /usr/bin/php /var/www/html/cacti/plugins/syslog/syslog_process.php --debug SYSLOG: Syslog Table is NOT Partitioned SYSLOG: Deleted 0, Syslog Message(s) (older than 2019-07-18) SYSLOG: Unique ID = 68 SYSLOG: Found 5, New Message(s) to process SYSLOG: Found 2, Removal Rule(s) to process SYSLOG: Deleted 4, Messages for removal rule 'Temporaily remove localhost entries' SYSLOG: Deleted 5, Message for removal rule 'Remove NTP clock updated messages' SYSLOG: Found 0, Alert Rules to process SYSLOG: Moved 0, Message(s) to the 'syslog' table SYSLOG: Deleted 0, Already Processed Message(s) from incoming SYSLOG: Deleted 0, Syslog alarm log Record(s) SYSLOG: Deleted 0, Syslog Host Record(s) SYSLOG: Deleted 0, Old programs from programs table SYSLOG: Deleted 0, Syslog Host/Facility Record(s) SYSLOG: Processing Reports... SYSLOG: We have 0 Reports in the database SYSLOG: Finished processing Reports... 2020/01/17 11:22:42 - SYSTEM SYSLOG STATS: Time:0.07 Deletes:0 Incoming:5 Removes:5 XFers:0 Alerts:0 Alarms:0 Reports:0

The rule is not actually deleting the messages.

TheWitness commented 4 years ago

Yea, that should be an easy fix. Glad you are using a separate database so we can get testing done on that. If you review the code, you will see several examples where they define $syslog_db_default.syslog_hosts, you just need to make that change.

TheWitness commented 4 years ago

This should be resolved now. Download the latest develop and report back.