Skip to content

Commit

Permalink
Update problem detection to avoid new servers throwing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed Jul 29, 2024
1 parent e6e90fc commit bfdb505
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,13 @@ function Invoke-AnalyzerOsInformation {
$days = 7
$testDate = (Get-Date).AddDays(-$days)
foreach ($logType in $osInformation.EventLogInformation.Keys) {
if ($osInformation.EventLogInformation[$logType].LastLogEntry -gt $testDate) {
$logInfo = $osInformation.EventLogInformation[$logType]
# If the log isn't at the max limit, it is possible that they just cleared the logs or on a new server. This should be rare scenario.
if ($logInfo.LastLogEntry -gt $testDate -and
$logInfo.FileSize -ge $logInfo.MaxSize) {
$params = $baseParams + @{
Name = "Event Log - $logType"
Details = "--ERROR-- Not enough logs to cover $days days. Last log entry is at $($osInformation.EventLogInformation[$logType].LastLogEntry)." +
Details = "--ERROR-- Not enough logs to cover $days days. Last log entry is at $($logInfo.LastLogEntry)." +
" This could cause issues with determining Root Cause Analysis."
DisplayWriteType = "Red"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function Get-EventLogInformation {
$results.Add($log, ([PSCustomObject]@{
LastLogEntry = $lastLogEntry.TimeCreated
MaxSize = $listLog.MaximumSizeInBytes
FileSize = $listLog.FileSize
LogMode = $listLog.LogMode.ToString()
IsEnabled = $listLog.IsEnabled
LogFilePath = $listLog.LogFilePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ Describe "Testing Health Checker by Mock Data Imports" {
It "Event Log Size Test" {
GetObject "Event Log - Application" |
Should -BeLike "--ERROR-- Not enough logs to cover 7 days. Last log entry is at *. This could cause issues with determining Root Cause Analysis."
GetObject "Event Log - System" |
Should -BeLike "--ERROR-- Not enough logs to cover 7 days. Last log entry is at *. This could cause issues with determining Root Cause Analysis."
}

It "TCP Keep Alive Time" {
Expand Down

0 comments on commit bfdb505

Please sign in to comment.