Cacti / plugin_syslog

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

Wrong SQL query for separated syslog db #39

Closed jpobeda closed 6 years ago

jpobeda commented 6 years ago

Hi, I'm opening this as a bug to not mess up https://github.com/Cacti/plugin_syslog/issues/9 issue.

At the end what I thought it was the syslog table, was the syslog database name.

I'm getting this error by simply adding a new alert rule using 'hostname is'. I'm surprised nobody else has got this issue.

DBCALL ERROR: SQL Assoc Failed!, Error:1054, SQL:'SELECT * FROM `syslog`.`syslog_incoming` WHERE host_id='myswitch3' AND status=2'
--
13/Nov/2017 15:10:56 - DBCALL ERROR: SQL Assoc Failed!, Error: Unknown column 'host_id' in 'where clause'

So I think there shouldn't be an space between the two if we intend to query FROM database.table, right?

jpobeda commented 6 years ago

I was wrong, that was a valid query but it always throws an error because if you create your rule to match host_id it builds queries for both 'syslog' table and 'syslog_incoming'. Being host_id valid for 'syslog' but not for syslog_incoming. It actually processes the valid query but fails in the other one.

So I guess we could chuck a note or description to warn users on how this works and what to expect.

Closing.