Skip to content

fix: legacy hostField and collector status query failures (#451, #452, #453) - #455

Merged
TheWitness merged 3 commits into
developfrom
fix/451-453-host-field-collector-status
Nov 16, 2026
Merged

TheWitness merged 3 commits into
developfrom
fix/451-453-host-field-collector-status

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Description

  • syslog_incoming_host_field() maps the stale hostField = 'host_id' setting to the real syslog_incoming.host column. It is used by the device-rule mute/maintenance filter, host alerts, and the alert/removal query builders. config_local.php.dist now ships host.
  • syslog_replication_collector_status() no longer joins poller on the Syslog connection. It reads the collector summary from the Syslog DB, then resolves hostnames from the Cacti poller table over the Cacti connection. A failed query now returns [] (or a null hostname) instead of tripping the array return type.
  • Adds Pest coverage and CHANGELOG entries.

Related Issue

Fixes #451
Fixes #452
Fixes #453

Motivation and Context

How Has This Been Tested?

Run in WSL (PHP 8.3) against Cacti's Pest tree:

  • pest tests/Unit/DeviceRulePolicyTest.php tests/Unit/ReplicationDeliveryTest.php tests/Unit/ReplicationCoverageRegressionTest.php - passed (32 tests)
  • pest tests/Unit tests/Security - 662 passed, 1 failed. The failure, ItemShareVisibilityTest ("The granted id resolves"), also fails on unmodified origin/develop when the whole suite runs. It passes when run alone, so it is an order-dependent failure unrelated to this change.
  • php -l includes/functions.php - passed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation repository accordingly.

TheWitness and others added 2 commits November 16, 2026 13:11
…, #452, #453)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eate memo

The memo added in #454 returned early for any previously successful
db_update_table() call, so an owner column narrowed after the first check
was never widened in the same process and the database regression test
failed on every PHP version. Remember creations only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TheWitness
TheWitness marked this pull request as ready for review November 16, 2026 19:13
Copilot AI balanced review requested due to automatic review settings November 16, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A regression test is needed to verify that repeated updates to an existing table both reach db_update_table() and that a failure on the second call is propagated.

1 open issue
What changed in this PR

This PR fixes incoming-host mapping and collector status failures in the Cacti Syslog plugin, addressing #451–#453. It also adjusts schema caching so repeated updates can repair existing tables.

Changes:

  • Maps legacy hostField = 'host_id' to host across incoming rule queries and corrects the configuration template.
  • Separates Syslog collector reads from Cacti hostname lookups, handles failed queries, and adds regression coverage.
  • Limits schema-operation caching to successful table creation.
File Description
tests/​Unit/​ReplicationDeliveryTest.php Tests separate hostname lookups and query-failure handling.
tests/​Unit/​DeviceRulePolicyTest.php Tests legacy host mapping and custom-field preservation.
includes/​schema.php Keeps existing-table updates out of the replay cache.
includes/​functions.php Normalizes incoming host fields and separates collector queries by database.
config_local.php.dist Changes the default incoming host field to host.
CHANGELOG.md Documents the host mapping, collector status, and schema-cache fixes.

Review effort: Balanced

Comment thread includes/schema.php Resolved
…_table()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit ada1648 into develop Nov 16, 2026
11 checks passed
@TheWitness
TheWitness deleted the fix/451-453-host-field-collector-status branch November 16, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants