SYSLOG removal command with 'SQL command' not working

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
Rno
Cacti Pro User
Posts: 658
Joined: Wed Dec 07, 2011 9:19 am

SYSLOG removal command with 'SQL command' not working

Post by Rno »

I open a bug on github, but not sure it is one!
https://github.com/Cacti/plugin_syslog/issues/218

So maybe I get more luck here.

I try to setup a few filter based on SQL command like that:

Code: Select all

message REGEXP 'LINEPROTO-5-UPDOWN|LINK-3-UPDOWN'

What I want is all message containing one of this 2 messages to be transferred.
When I do so I got the following error messages, and the SQL query related to it:

Code: Select all

01/12/2023 14:50:59 - SYSLOG error mysql1: INSERT INTO `syslog`.`syslog_removed` (logtime, priority_id, facility_id, program_id, host_id, message) SELECT logtime, priority_id, facility_id, host_id, message FROM `syslog`.`syslog` WHERE message REGEXP 'LINEPROTO-5-UPDOWN|LINK-3-UPDOWN'
01/12/2023 14:50:59 - CMDPHP ERROR: A DB Exec Failed!, Error: Column count doesn't match value count at row 1
01/12/2023 14:50:59 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_removal.php[61]:form_actions(), /plugins/syslog/syslog_removal.php[140]:api_syslog_removal_reprocess(), /plugins/syslog/syslog_removal.php[333]:syslog_remove_items(), /plugins/syslog/functions.php[619]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[362]:db_execute_prepared())

01/12/2023 14:50:59 - SYSLOG error mysql: DELETE syslog FROM `syslog`.`syslog` INNER JOIN `syslog`.`syslog_facilities` AS sf ON sf.facility_id = si.facility_id INNER JOIN `syslog`.`syslog_priorities` AS sp ON sp.priority_id = si.priority_id INNER JOIN `syslog`.`syslog_programs` AS spg ON spg.program = si.program INNER JOIN `syslog`.`syslog_hosts` AS sh ON sh.host = si.host WHERE (message REGEXP 'LINEPROTO-5-UPDOWN|LINK-3-UPDOWN')
01/12/2023 14:50:59 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'si.facility_id' in 'on clause'
01/12/2023 14:50:59 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_removal.php[61]:form_actions(), /plugins/syslog/syslog_removal.php[140]:api_syslog_removal_reprocess(), /plugins/syslog/syslog_removal.php[333]:syslog_remove_items(), /plugins/syslog/functions.php[624]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[362]:db_execute_prepared())

The 'SYSLOG error mysql1' and 'SYSLOG error mysql' is a log I add on function.php line 618 and 623

Maybe I do the SQL command in a bad way, I don't understand the error message on 'SYSLOG error mysql1'
As for the 'SYSLOG error mysql' somehow the table alias si for the facility_id is missing
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
TheWitness
Developer
Posts: 16897
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: SYSLOG removal command with 'SQL command' not working

Post by TheWitness »

Was there a fix on this today in GitHub?
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Rno
Cacti Pro User
Posts: 658
Joined: Wed Dec 07, 2011 9:19 am

Re: SYSLOG removal command with 'SQL command' not working

Post by Rno »

Yes, it was #217 and #218 by xmacan
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests