2019-09-29 12:25:40 -04:00
|
|
|
function Read-IcingaAgentLogFile()
|
|
|
|
|
{
|
2021-11-04 13:47:45 -04:00
|
|
|
if ((Test-IcingaAgentFeatureEnabled -Feature 'windowseventlog') -And ([version](Get-IcingaAgentVersion).Full) -ge (New-IcingaVersionObject -Version '2.13.0')) {
|
|
|
|
|
|
|
|
|
|
# Icinga 2.13.0 and beyond will log directly into the EventLog
|
2021-11-05 08:34:45 -04:00
|
|
|
Read-IcingaWindowsEventLog -LogName 'Application' -Source 'Icinga 2' -MaxEntries 500;
|
2021-11-04 13:47:45 -04:00
|
|
|
} else {
|
|
|
|
|
$Logfile = Join-Path -Path (Get-IcingaAgentLogDirectory) -ChildPath 'icinga2.log';
|
|
|
|
|
if ((Test-Path $Logfile) -eq $FALSE) {
|
|
|
|
|
Write-IcingaConsoleError 'Icinga 2 logfile not present. Unable to load it';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Get-Content -Path $Logfile -Tail 20 -Wait;
|
|
|
|
|
}
|
2019-09-29 12:25:40 -04:00
|
|
|
}
|