Skip to content

Conversation

@bobsira
Copy link
Contributor

@bobsira bobsira commented Jul 22, 2025

This pull request introduces targeted improvements to error logging in the LogFileMonitor component. The main change is the suppression of log messages for the benign ERROR_NOT_SUPPORTED error, which helps reduce unnecessary log noise while still capturing actionable errors.

Error logging improvements:

  • Suppressed logging of ERROR_NOT_SUPPORTED when failing to open log files in InitializeDirectoryChangeEventsQueue() to avoid log pollution from benign errors. [1] [2]
  • Suppressed logging of ERROR_NOT_SUPPORTED when failing to query file ID in LogFileAddEventHandler() for the same reason, ensuring only actionable errors are logged.

This comment was marked as outdated.

Comment on lines +709 to +718
if (GetLastError() != ERROR_NOT_SUPPORTED)
{
logWriter.TraceError(
Utility::FormatString(
L"Error in log file monitor. Failed to open file %ws. Error = %d",
fileName.c_str(),
GetLastError()
).c_str()
);
}
Copy link
Contributor

@mloskot mloskot Jul 23, 2025

Choose a reason for hiding this comment

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

@bobsira I think similar workaround is needed here

logWriter.TraceError(
Utility::FormatString(
L"Error in log file monitor. Failed to query file ID. File: %ws. Error: %d",
fullLongPath.c_str(),
status
).c_str()
);

I'm testing your LogMonitor.exe build you linked in #214 (comment) and

image

The waitInSeconds: 10 does not seem to help delay the files query in this particular case.

My LogMonitorConfig.json is this

{
  "LogConfig": {
    "sources": [
      {
        "includeSubdirectories": false,
        "filter": "*.log",
        "directory": "C:\\Logs",
        "waitInSeconds": 10,
        "type": "File",
        "includeFileNames": true
      }
    ]
  }
}

The fix for ordering of the waitInSeconds seem to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mloskot please confirm if the issue still exists in this binary -> https://minikubevhdimagebuider.blob.core.windows.net/versions/LogMonitor.exe

It has the change you've suggested. if it's there we can move this fix to a different PR and let this handle the parser fix

Copy link
Contributor

Choose a reason for hiding this comment

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

@bobsira Hmm, I've just tested LogMonitor.exe from that URL

Invoke-WebRequest -Uri 'https://minikubevhdimagebuider.blob.core.windows.net/versions/LogMonitor.exe' -OutFile C:/LogMonitor.exe -UseBasicParsing

and this version is reported inside the container - am I using the right custom ad-hoc build of yours?

image

but I can't see any difference

image

Here is my config inside the container

image

and logs location

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, strange that should be the binary with the change. I'll go ahead and split the PR for now. I have a feeling this issue might be coming from another place in the code as well so let's have it addressed in a different PR.

Copy link
Contributor

@mloskot mloskot Aug 5, 2025

Choose a reason for hiding this comment

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

Good idea. Let's take baby steps. The overall direction seems fine though 😊

@bobsira bobsira changed the title Fix JSON parser to correctly handle numeric values Suppress unnecessary error log for ERROR_NOT_SUPPORTED cases Aug 7, 2025
@mloskot
Copy link
Contributor

mloskot commented Nov 5, 2025

@bobsira Any update on this?

@mloskot
Copy link
Contributor

mloskot commented Dec 5, 2025

@bobsira @CharityKathure @profnandaa Any chance to get this merged and released?

@bobsira
Copy link
Contributor Author

bobsira commented Dec 16, 2025

@bobsira @CharityKathure @profnandaa Any chance to get this merged and released?

@mloskot Charity and Nandaa are not working on Log Monitor anymore. I'll revisit this issue this week!

@bobsira
Copy link
Contributor Author

bobsira commented Jan 9, 2026

@mloskot I'll merge this and we will have it in the next release.

@bobsira bobsira merged commit 99770f8 into main Jan 9, 2026
4 checks passed
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.

4 participants