Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Event log may have null message #16

Merged
merged 1 commit into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
Sample output

````markdown
# Windows Secure Auditor: 0.0.11
# Windows Secure Auditor: 0.0.12

## System Information

Expand Down
2 changes: 1 addition & 1 deletion README.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
範例輸出

````markdown
# Windows Secure Auditor: 0.0.11
# Windows Secure Auditor: 0.0.12

## 系統資訊

Expand Down
2 changes: 1 addition & 1 deletion SecureAuditor.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '0.0.11'
ModuleVersion = '0.0.12'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
10 changes: 6 additions & 4 deletions rules/EventLogs.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Test($config) {
if ($events.Count -eq 0) {
return
}
Write-Output "`n## $($i18n.EventLogs)"
Write-Output "`n## $($i18n.EventLogs)`n"
$events = $events | Select-Object Id, Level, LevelDisplayName, LogName, Message | Sort-Object -Property Level, Id | Group-Object -Property Level, Id
$maxEvents = [int]::Parse($config.EventLogs.MaxEvents)
$exclude = $config.EventLogs.Exclude
Expand All @@ -47,10 +47,12 @@ function Test($config) {
}
$level = $event.Group[0].LevelDisplayName
$logName = $event.Group[0].LogName
$message = $event.Group[0].Message.Trim()
$message = $event.Group[0].Message
$count = $event.Count;
Write-Output "`n- $($i18n.Level): $($level), $($i18n.EventId): $($eventId), $($i18n.LogName): $($logName), $($i18n.Count): $($count)"
Write-Output "`n``````log`n$($message)`n``````"
Write-Output "- $($i18n.Level): $($level), $($i18n.EventId): $($eventId), $($i18n.LogName): $($logName), $($i18n.Count): $($count)"
if ($null -ne $message) {
Write-Output "`n``````log`n$($message.Trim())`n```````n"
}
$eventCount += 1
}
}