Skip to content
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
1 change: 1 addition & 0 deletions doc/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Bugfixes

* [#707](https://github.com/Icinga/icinga-powershell-framework/pull/707) Fixes size of the `Icinga for Windows` eventlog by setting it to `20MiB`, allowing to store more events before they are overwritten
* [#710](https://github.com/Icinga/icinga-powershell-framework/pull/710) Fixes various console errors while running Icinga for Windows outside of an administrative shell

## 1.12.0 (2024-03-26)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ function Set-IcingaServiceEnvironment()
return;
}

# Don't do anything if we are not inside an administrative shell
if ((Test-AdministrativeShell) -eq $FALSE) {
return;
}

# Use scheduled tasks to fetch our current service configuration for faster load times afterwards
$IcingaService = Invoke-IcingaWindowsScheduledTask -JobType GetWindowsService -ObjectName 'icinga2';
$PowerShellService = Invoke-IcingaWindowsScheduledTask -JobType GetWindowsService -ObjectName 'icingapowershell';
Expand Down
10 changes: 10 additions & 0 deletions lib/core/logging/Register-IcingaEventLog.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ function Register-IcingaEventLog()
[string]$LogName = $null
);

if ((Test-AdministrativeShell) -eq $FALSE) {
return;
}

if ([string]::IsNullOrEmpty($LogName)) {
New-EventLog -LogName 'Icinga for Windows' -Source 'IfW::Framework' -ErrorAction SilentlyContinue;
New-EventLog -LogName 'Icinga for Windows' -Source 'IfW::Service' -ErrorAction SilentlyContinue;
Expand All @@ -15,6 +19,12 @@ function Register-IcingaEventLog()
}

$IfWEventLog = Get-WinEvent -ListLog 'Icinga for Windows';

# In case the value is already set, nothing to do
if ($IfWEventLog.MaximumSizeInBytes -ge 20971520) {
return;
}

# Set the size to 20MiB
$IfWEventLog.MaximumSizeInBytes = 20971520;
$IfWEventLog.SaveChanges();
Expand Down