Skip to content

fix: per-host filter not applied in syslogsummary PDO ConsolidateDataByField#129

Merged
alorbach merged 1 commit into
masterfrom
copilot/fix-syslog-summary-per-host-issues
May 6, 2026
Merged

fix: per-host filter not applied in syslogsummary PDO ConsolidateDataByField#129
alorbach merged 1 commit into
masterfrom
copilot/fix-syslog-summary-per-host-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

In the syslog summary PDF report, every host section showed messages from all hosts instead of only that host's messages. Summary counts were correct; only the per-host consolidated message lists were unfiltered.

Root cause

ConsolidateSyslogmessagesPerHost resets and rebuilds filters on each loop iteration:

ResetFilters()          → clears _SQLwhereClause to ""
SetFilter(...)          → updates _filters only
RemoveFilters(SYSLOG_HOST)
AppendFilter($myHost)   → _filters now has correct host scope
ConsolidateDataByField  → used _SQLwhereClause directly → "" → no WHERE clause → all rows

logstreampdo.class.php's ConsolidateDataByField consumed _SQLwhereClause directly without detecting the empty/stale state and rebuilding it from _filters. The mysqli backend (logstreamdb.class.php) already handles this correctly, and so does the PDO ConsolidateItemListByField — only ConsolidateDataByField in the PDO path was missing the guard.

Fix

Added the same stale-clause guard already present in both sibling methods:

// Create SQL Where Clause!
if ( $this->_SQLwhereClause == "" )
{
    $res = $this->CreateSQLWhereClause();
    if ( $res != SUCCESS )
        return $res;
}

This also corrects the same latent bug in ConsolidateEventsPerHost (eventsummary) for PDO-backed sources.


Summary by cubic

Fixes per-host sections in the syslog summary (PDO backend) showing messages from all hosts by rebuilding the SQL WHERE clause from active filters when needed. Also corrects the same issue in the event summary.

  • Bug Fixes
    • Regenerate WHERE clause in ConsolidateDataByField when empty to apply current filters.
    • Per-host consolidation now works for syslog summary and event summary on PDO sources.

Written for commit 81fbdc6. Summary will update on new commits.

@alorbach
Copy link
Copy Markdown
Member

alorbach commented May 6, 2026

@codex review

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@alorbach alorbach merged commit 45f36cb into master May 6, 2026
6 checks passed
@alorbach alorbach deleted the copilot/fix-syslog-summary-per-host-issues branch May 6, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants