mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes error while writing too large eventlog msges
This commit is contained in:
parent
054459cbce
commit
4c628c737e
2 changed files with 20 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#159](https://github.com/Icinga/icinga-powershell-framework/pull/159) Fixes crash during update of the Icinga Framework, caused by the newly introduced experimental feature for code caching
|
* [#159](https://github.com/Icinga/icinga-powershell-framework/pull/159) Fixes crash during update of the Icinga Framework, caused by the newly introduced experimental feature for code caching
|
||||||
* [#165](https://github.com/Icinga/icinga-powershell-framework/pull/165) Fixes fetching for Icinga Agent certificate for REST-Api daemon on upper/lower case hostname mismatch
|
* [#165](https://github.com/Icinga/icinga-powershell-framework/pull/165) Fixes fetching for Icinga Agent certificate for REST-Api daemon on upper/lower case hostname mismatch
|
||||||
* [#166](https://github.com/Icinga/icinga-powershell-framework/pull/166) Fixes fetching of Icinga Agent MSI packages by correctly comparing versions to ensure we always use the latest version and fixes `release` usage for local/network drive sources
|
* [#166](https://github.com/Icinga/icinga-powershell-framework/pull/166) Fixes fetching of Icinga Agent MSI packages by correctly comparing versions to ensure we always use the latest version and fixes `release` usage for local/network drive sources
|
||||||
|
* [#167](https://github.com/Icinga/icinga-powershell-framework/pull/167) Fixes error while writing EventLog entries with too large message size
|
||||||
|
|
||||||
## 1.2.0 (2020-08-28)
|
## 1.2.0 (2020-08-28)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,25 @@ function Write-IcingaEventMessage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[int]$MaxEventLogMessageSize = 30000;
|
||||||
|
|
||||||
|
if ($EventLogMessage.Length -ge $MaxEventLogMessageSize) {
|
||||||
|
while ($EventLogMessage.Length -ge $MaxEventLogMessageSize) {
|
||||||
|
$CutMessage = $EventLogMessage.Substring(0, $MaxEventLogMessageSize);
|
||||||
|
Write-EventLog -LogName Application `
|
||||||
|
-Source 'Icinga for Windows' `
|
||||||
|
-EntryType $EntryType `
|
||||||
|
-EventId $EventId `
|
||||||
|
-Message $CutMessage;
|
||||||
|
|
||||||
|
$EventLogMessage = $EventLogMessage.Substring($MaxEventLogMessageSize, $EventLogMessage.Length - $MaxEventLogMessageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($EventLogMessage)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Write-EventLog -LogName Application `
|
Write-EventLog -LogName Application `
|
||||||
-Source 'Icinga for Windows' `
|
-Source 'Icinga for Windows' `
|
||||||
-EntryType $EntryType `
|
-EntryType $EntryType `
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue