2020-03-24 09:04:41 -04:00
|
|
|
function Register-IcingaEventLog()
|
|
|
|
|
{
|
2022-01-14 13:57:43 -05:00
|
|
|
param (
|
|
|
|
|
[string]$LogName = $null
|
|
|
|
|
);
|
2020-03-24 09:04:41 -04:00
|
|
|
|
2024-04-02 04:42:47 -04:00
|
|
|
if ((Test-AdministrativeShell) -eq $FALSE) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-14 13:57:43 -05:00
|
|
|
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;
|
|
|
|
|
New-EventLog -LogName 'Icinga for Windows' -Source 'IfW::Debug' -ErrorAction SilentlyContinue;
|
|
|
|
|
} else {
|
|
|
|
|
$LogName = [string]::Format('IfW::{0}', $LogName);
|
2020-08-06 13:06:59 -04:00
|
|
|
|
2022-01-14 13:57:43 -05:00
|
|
|
New-EventLog -LogName 'Icinga for Windows' -Source $LogName -ErrorAction SilentlyContinue;
|
2020-03-24 09:04:41 -04:00
|
|
|
}
|
2024-03-29 10:38:08 -04:00
|
|
|
|
|
|
|
|
$IfWEventLog = Get-WinEvent -ListLog 'Icinga for Windows';
|
2024-04-02 04:42:47 -04:00
|
|
|
|
|
|
|
|
# In case the value is already set, nothing to do
|
|
|
|
|
if ($IfWEventLog.MaximumSizeInBytes -ge 20971520) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-29 10:38:08 -04:00
|
|
|
# Set the size to 20MiB
|
|
|
|
|
$IfWEventLog.MaximumSizeInBytes = 20971520;
|
|
|
|
|
$IfWEventLog.SaveChanges();
|
2020-03-24 09:04:41 -04:00
|
|
|
}
|