Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When removing a rule, wrong database connection is used #154

Closed
bmfmancini opened this issue Jun 11, 2021 · 4 comments
Closed

When removing a rule, wrong database connection is used #154

bmfmancini opened this issue Jun 11, 2021 · 4 comments

Comments

@bmfmancini
Copy link
Member

Hey Guys,

I found that when you make a removal rule the following backtrace and sql error comes up

2021-06-11 14:41:47 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_removal.php[57]:form_actions(), /plugins/syslog/syslog_removal.php[136]:api_syslog_removal_reprocess(), /plugins/syslog/syslog_removal.php[342]:db_fetch_cell_prepared(), /lib/database.php[427]:db_execute_prepared())
2021-06-11 14:41:47 - CMDPHP ERROR: A DB Cell Failed!, Error: Table 'cacti.syslog_remove' doesn't exist
2021-06-11 14:41:23 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_removal.php[57]:form_actions(), /plugins/syslog/syslog_removal.php[136]:api_syslog_removal_reprocess(), /plugins/syslog/syslog_removal.php[342]:db_fetch_cell_prepared(), /lib/database.php[427]:db_execute_prepared())
2021-06-11 14:41:23 - CMDPHP ERROR: A DB Cell Failed!, Error: Table 'cacti.syslog_remove' doesn't exist

No issue with functionality while looking deeper into this the plugin attempts to go to cacti.syslog_removal which doesn't exist
I am using a separate DB and the table does exist in that DB I don't see in the code where it may be hard coded to use the Cacti DB

I see the removal rule populated in the syslog db and the rule works as expected

@netniV
Copy link
Member

netniV commented Jun 11, 2021

It could be that the syslog database id wasn't passed with the query. Since it is in a separate db, it will not use the default conn id.

@netniV netniV changed the title Syslog 3.1 SQL error when creating a removal rule When removing a rule, wrong database connection is used Jun 11, 2021
@netniV netniV closed this as completed in 29f63e0 Jun 11, 2021
@netniV
Copy link
Member

netniV commented Jun 11, 2021

Or rather that it's using the play db_fetch functions rather than the syslog_fetch ones.

@bmfmancini
Copy link
Member Author

Cool! good catch I will test it out

@bmfmancini
Copy link
Member Author

Looks good !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants