Write also /var/lib/icinga2/api/zones-stage-startup-last-failed.log

in addition to /var/lib/icinga2/api/zones-stage-startup.log
to prevent the next success to overwrite the last failure.
This commit is contained in:
Alexander A. Klimov 2022-04-07 11:30:52 +02:00
parent 3b03050340
commit 4fb9e7421e

View File

@ -645,10 +645,15 @@ void ApiListener::TryActivateZonesStage(const std::vector<String>& relativePaths
return;
}
String failedLogFile = apiDir + "/zones-stage-startup-last-failed.log";
std::ofstream fpFailedLog(failedLogFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
fpFailedLog << pr.Output;
fpFailedLog.close();
// Error case.
Log(LogCritical, "ApiListener")
<< "Config validation failed for staged cluster config sync in '" << apiZonesStageDir
<< "'. Aborting. Logs: '" << logFile << "'";
<< "'. Aborting. Logs: '" << failedLogFile << "'";
ApiListener::Ptr listener = ApiListener::GetInstance();