Export all pages, simplified datefrom, and suppress fix#92
Export all pages, simplified datefrom, and suppress fix#92rusak47 wants to merge 2 commits intorsyslog:masterfrom
Conversation
|
@alorbach please, check this pull request. |
|
@cubic-dev-ai review |
@alorbach I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
7 issues found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/index.php">
<violation number="1" location="src/index.php:357">
P2: Duplicate suppression reads `timereported` without checking presence/shape, which can cause undefined index/offset and incorrect suppression behavior for views/sources lacking that field.</violation>
<violation number="2" location="src/index.php:373">
P2: Suppressed duplicate count is dropped when duplicate runs end at page/stream boundary because pending count is never flushed before loop exit.</violation>
<violation number="3" location="src/index.php:377">
P2: Suppression threshold is off by one: a single suppressed duplicate (`$duplicateCount == 1`) is not reported or counted.</violation>
</file>
<file name="src/export.php">
<violation number="1" location="src/export.php:79">
P2: Export logic uses `SuppressDuplicatedMessages` instead of the new export-specific `ExportSuppressDuplicatedMessages`, so export suppression is still incorrectly coupled to view settings.</violation>
<violation number="2" location="src/export.php:220">
P2: Export now assumes `timereported` is always present, but stream is opened with view columns only, causing possible undefined-index access and broken duplicate/date-range behavior when that field is not selected.</violation>
<violation number="3" location="src/export.php:222">
P2: Duplicate suppression reads `$szLastMessage` before initialization, risking undefined-variable behavior and incorrect first-record suppression.</violation>
<violation number="4" location="src/export.php:334">
P2: Trailing suppressed-duplicate groups are dropped when the stream ends before a non-duplicate triggers summary injection.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| }else{ | ||
| //inject entry about suppressed records | ||
| // FIXME any better way of doing that? | ||
| if($duplicateCount > 1){ |
There was a problem hiding this comment.
P2: Suppression threshold is off by one: a single suppressed duplicate ($duplicateCount == 1) is not reported or counted.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/index.php, line 377:
<comment>Suppression threshold is off by one: a single suppressed duplicate (`$duplicateCount == 1`) is not reported or counted.</comment>
<file context>
@@ -336,38 +339,78 @@
+ }else{
+ //inject entry about suppressed records
+ // FIXME any better way of doing that?
+ if($duplicateCount > 1){
+ foreach($content['Columns'] as $mycolkey)
{
</file context>
| if($duplicateCount > 1){ | |
| if($duplicateCount > 0){ |
| else | ||
| // Skip if same msg | ||
| // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages) | ||
| $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]); //sign depends on direction |
There was a problem hiding this comment.
P2: Duplicate suppression reads timereported without checking presence/shape, which can cause undefined index/offset and incorrect suppression behavior for views/sources lacking that field.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/index.php, line 357:
<comment>Duplicate suppression reads `timereported` without checking presence/shape, which can cause undefined index/offset and incorrect suppression behavior for views/sources lacking that field.</comment>
<file context>
@@ -336,38 +339,78 @@
- else
+ // Skip if same msg
+ // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages)
+ $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]); //sign depends on direction
+ //echo "uID=$uID; duplicates ($duplicateCount); delta ts = $tsDiff; isDublicate=".($szLastMessage == $logArray[SYSLOG_MESSAGE])."<br>";
+ if ( $szLastMessage == $logArray[SYSLOG_MESSAGE] && ($tsDiff < $DuplicateRecordMaxTsDistance))
</file context>
| // --- | ||
|
|
||
| // Skip entry | ||
| continue; |
There was a problem hiding this comment.
P2: Suppressed duplicate count is dropped when duplicate runs end at page/stream boundary because pending count is never flushed before loop exit.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/index.php, line 373:
<comment>Suppressed duplicate count is dropped when duplicate runs end at page/stream boundary because pending count is never flushed before loop exit.</comment>
<file context>
@@ -336,38 +339,78 @@
+ // ---
+
+ // Skip entry
+ continue;
+ }else{
+ //inject entry about suppressed records
</file context>
| if(!$content['ExportAllMatchPages'] && $counter >= $content['CurrentViewEntriesPerPage']){ | ||
| break; | ||
| } | ||
| } while ($ret == SUCCESS); |
There was a problem hiding this comment.
P2: Trailing suppressed-duplicate groups are dropped when the stream ends before a non-duplicate triggers summary injection.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/export.php, line 334:
<comment>Trailing suppressed-duplicate groups are dropped when the stream ends before a non-duplicate triggers summary injection.</comment>
<file context>
@@ -286,7 +321,17 @@
+ if(!$content['ExportAllMatchPages'] && $counter >= $content['CurrentViewEntriesPerPage']){
+ break;
+ }
+ } while ($ret == SUCCESS);
if ( $content['read_direction'] == EnumReadDirection::Forward )
</file context>
| // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages) | ||
| $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]); | ||
| //echo "uID=$uID; duplicates ($duplicateCount); delta ts = $tsDiff; isDublicate=".($szLastMessage == $logArray[SYSLOG_MESSAGE])."<br>\n"; | ||
| if ( $szLastMessage == $logArray[SYSLOG_MESSAGE] && ($tsDiff < $DuplicateRecordMaxTsDistance)) |
There was a problem hiding this comment.
P2: Duplicate suppression reads $szLastMessage before initialization, risking undefined-variable behavior and incorrect first-record suppression.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/export.php, line 222:
<comment>Duplicate suppression reads `$szLastMessage` before initialization, risking undefined-variable behavior and incorrect first-record suppression.</comment>
<file context>
@@ -203,32 +205,65 @@
+ // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages)
+ $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]);
+ //echo "uID=$uID; duplicates ($duplicateCount); delta ts = $tsDiff; isDublicate=".($szLastMessage == $logArray[SYSLOG_MESSAGE])."<br>\n";
+ if ( $szLastMessage == $logArray[SYSLOG_MESSAGE] && ($tsDiff < $DuplicateRecordMaxTsDistance))
{
- // Skip if same msg
</file context>
| $content['error_occured'] = false; | ||
|
|
||
| $content['ExportAllMatchPages'] = GetConfigSetting("ExportAllMatchPages", 0, CFGLEVEL_USER) == 1; | ||
| $content['SuppressDuplicatedMessages'] = GetConfigSetting("SuppressDuplicatedMessages", 0, CFGLEVEL_USER) == 1; |
There was a problem hiding this comment.
P2: Export logic uses SuppressDuplicatedMessages instead of the new export-specific ExportSuppressDuplicatedMessages, so export suppression is still incorrectly coupled to view settings.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/export.php, line 79:
<comment>Export logic uses `SuppressDuplicatedMessages` instead of the new export-specific `ExportSuppressDuplicatedMessages`, so export suppression is still incorrectly coupled to view settings.</comment>
<file context>
@@ -75,6 +75,8 @@
$content['error_occured'] = false;
+$content['ExportAllMatchPages'] = GetConfigSetting("ExportAllMatchPages", 0, CFGLEVEL_USER) == 1;
+$content['SuppressDuplicatedMessages'] = GetConfigSetting("SuppressDuplicatedMessages", 0, CFGLEVEL_USER) == 1;
// Check required input parameters
if (
</file context>
| $content['SuppressDuplicatedMessages'] = GetConfigSetting("SuppressDuplicatedMessages", 0, CFGLEVEL_USER) == 1; | |
| $content['SuppressDuplicatedMessages'] = GetConfigSetting("ExportSuppressDuplicatedMessages", 0, CFGLEVEL_USER) == 1; |
| else | ||
| // Skip if same msg | ||
| // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages) | ||
| $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]); |
There was a problem hiding this comment.
P2: Export now assumes timereported is always present, but stream is opened with view columns only, causing possible undefined-index access and broken duplicate/date-range behavior when that field is not selected.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/export.php, line 220:
<comment>Export now assumes `timereported` is always present, but stream is opened with view columns only, causing possible undefined-index access and broken duplicate/date-range behavior when that field is not selected.</comment>
<file context>
@@ -203,32 +205,65 @@
- else
+ // Skip if same msg
+ // but don't merge same messages if timestamp difference is greater than precofigured (useful when filtering same messages)
+ $tsDiff = abs($szLastMessageTimestamp - $logArray["timereported"][EVTIME_TIMESTAMP]);
+ //echo "uID=$uID; duplicates ($duplicateCount); delta ts = $tsDiff; isDublicate=".($szLastMessage == $logArray[SYSLOG_MESSAGE])."<br>\n";
+ if ( $szLastMessage == $logArray[SYSLOG_MESSAGE] && ($tsDiff < $DuplicateRecordMaxTsDistance))
</file context>
|
@rusak47 sorry for the long delay - finally reviewing all PRs here. |
No problem at all — I'm glad it's being reviewed. I believe it could still be useful, but I'll need some time to get back into it, as I haven't used this tool for a while. Thanks for the heads-up! |
Uh oh!
There was an error while loading. Please reload this page.