Skip to content

Commit

Permalink
Merge pull request #78 from microsoft/20241115_SQLCheck_ERRORLOG
Browse files Browse the repository at this point in the history
SQLCheck: ERRORLOG improvement to handle more than 10 ERRORLOG files
  • Loading branch information
Malcolm-Stewart authored Nov 15, 2024
2 parents e936c6e + d1cf398 commit cbdc9aa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
Binary file modified SQLCheck/.vs/SQLCheck/v15/Server/sqlite3/storage.ide
Binary file not shown.
11 changes: 6 additions & 5 deletions SQLCheck/SQLCheck/Collectors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3081,24 +3081,25 @@ public static void ProcessMSSQLServer(DataSet ds, DataRow SQLInstance, DataRow S

public static void ProcessSQLErrorlog_File(DataRow SQLServer) // must come prior to loading the certificate from the registry key
{
string baseFileName = SQLServer.GetString("ErrorLogPath");
string baseFileName = SQLServer.GetString("ErrorLogPath"); // includes the filename ERRORLOG as well as the path
if (baseFileName == "") return;
string fileName = "";
string el = ""; // the entire log
string line = ""; // a single line
bool found = false;

//
// Find the first ERRORLOG[.n] file that starts from the beginning
// Find the first ERRORLOG[.n] file that starts from the beginning - can be more than 30 files, potentially, so we'll try up to 99; break when file not found
//

try
{
for (int i = 0; i < 10; i++)
for (int i = 0; i < 99; i++)
{
fileName = $@"{baseFileName}" + ((i > 0) ? $".{i}" : "");
el = Utility.GetFileText($@"{fileName}"); // returns empty string if the file does not exist
if (el.Length > 0 && SmartString.GetStringLine(el, "Registry startup parameters") != "")
el = Utility.GetFileText($@"{fileName}"); // returns empty string if the file does not exist
if (el.Length == 0) break; // end of files if names aren't contiguous or no more files, i.e. file name not found
if (SmartString.GetStringLine(el, "Registry startup parameters") != "")
{
found = true;
break;
Expand Down
4 changes: 2 additions & 2 deletions SQLCheck/SQLCheck/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1435.0")]
[assembly: AssemblyFileVersion("1.0.1435.0")]
[assembly: AssemblyVersion("1.0.1437.0")]
[assembly: AssemblyFileVersion("1.0.1437.0")]
Binary file modified SQL_Network_Analyzer/.vs/SQLNetworkAnalyzer/v15/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion SQL_Network_Analyzer/SQLNA/ETLFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public Frame Read()

// FrameBuffer is empty and we're not done with the trace
// Spin and give the event handler time to add a few rows to the frame buffer
Thread.Sleep(1); // can we remove the delay?
// Thread.Sleep(1); // can we remove the delay?
}
}

Expand Down

0 comments on commit cbdc9aa

Please sign in to comment.