SYSLOG: makeing a date filter is lost when changing the page

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

SYSLOG: makeing a date filter is lost when changing the page

Post by Rno »

Hello team,
I need to be able to see the syslog event from the 2 days last week. When I select the start date and end date it's ok, but as soon as I switch to age 2 of the event list, it lsot my settings.

Anyone having the same issue ?
Production
Almalinux
php 7.4.2
mariadb 10.5.15
Cacti 1.2.25
Spine 1.2.25
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 0.98a

Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.26
Spine 1.2.26
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: 16874
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: SYSLOG: makeing a date filter is lost when changing the page

Post by TheWitness »

I did a pretty big performance update recently including making the device multi-select work through a callback (great feature if you have a lot of hosts (thousands)). Working on parallel query. Not sure I fixed this one though.
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: 649
Joined: Wed Dec 07, 2011 9:19 am

Re: SYSLOG: makeing a date filter is lost when changing the page

Post by Rno »

Hello,
So I did an upgrade to syslog 4.0
and One line is missing from function.php, and give this error:

Code: Select all

31/05/2022 13:29:06 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1707]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
31/05/2022 13:29:06 - CMDPHP ERROR: A DB Exec Failed!, Error: Incorrect database name ''
31/05/2022 13:29:06 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1704]:CactiErrorHandler())
31/05/2022 13:29:06 - ERROR PHP NOTICE in Plugin 'syslog': Undefined variable: syslogdb_default in file: /usr/share/cacti/plugins/syslog/functions.php on line: 1704
31/05/2022 13:29:06 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1707]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
31/05/2022 13:29:06 - CMDPHP ERROR: A DB Exec Failed!, Error: Incorrect database name ''
31/05/2022 13:29:06 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1704]:CactiErrorHandler())
31/05/2022 13:29:06 - ERROR PHP NOTICE in Plugin 'syslog': Undefined variable: syslogdb_default in file: /usr/share/cacti/plugins/syslog/functions.php on line: 1704
You should add this on 1699:

Code: Select all

	global $syslogdb_default;
it's missing on the
function syslog_strip_incoming_domains($uniqueID)

And you have a mistake on the table you try to reach in line 1707 (before the change I propose)

Code: Select all

function syslog_strip_incoming_domains($uniqueID) {
	$syslog_domains = read_config_option('syslog_domains');
	if ($syslog_domains != '') {
		$domains = explode(',', trim($syslog_domains));

		foreach($domains as $domain) {
			syslog_db_execute('UPDATE `' . $syslogdb_default . "`.`syslog_incoming`
				SET host = SUBSTRING_INDEX(host, '.', 1)
				WHERE host LIKE '%$domain'
				AND uniqueID = $uniqueID");
		}
	}
}
You try to access the field uniqueID in syslog_incoming table, but that field didn't exist.

If I look on setup.php, the creation of the table contain only the following field:

Code: Select all

		facility_id int(10) unsigned default NULL,
		priority_id int(10) unsigned default NULL,
		program varchar(40) default NULL,
		logtime TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
		host varchar(64) default NULL,
		message varchar(2048) NOT NULL DEFAULT '',
		seq bigint unsigned NOT NULL auto_increment,
		`status` tinyint(4) NOT NULL default '0',
And that give this error:

Code: Select all

31/05/2022 13:47:06 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1708]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
31/05/2022 13:47:06 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'uniqueID' in 'where clause'
31/05/2022 13:47:06 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[156]:syslog_preprocess_incoming_records(), /plugins/syslog/functions.php[1683]:syslog_strip_incoming_domains(), /plugins/syslog/functions.php[1708]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
31/05/2022 13:47:06 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'uniqueID' in 'where clause'
Production
Almalinux
php 7.4.2
mariadb 10.5.15
Cacti 1.2.25
Spine 1.2.25
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 0.98a

Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.26
Spine 1.2.26
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 0 guests