mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
ApiListener: Reset m_LogMessageCount
when rotating
Closing and re-opening that very same log file shouldn't reset the counter, otherwise some log files may exceed the max limit per file as their offset indicator is reset each time they are re-opened.
This commit is contained in:
parent
ed8156db28
commit
dfffb29c81
@ -1375,7 +1375,6 @@ void ApiListener::OpenLogFile()
|
||||
}
|
||||
|
||||
m_LogFile = new StdioStream(fp.release(), true);
|
||||
m_LogMessageCount = 0;
|
||||
SetLogMessageTimestamp(Utility::GetTime());
|
||||
}
|
||||
|
||||
@ -1405,6 +1404,9 @@ void ApiListener::RotateLogFile()
|
||||
if (!Utility::PathExists(newpath)) {
|
||||
try {
|
||||
Utility::RenameFile(oldpath, newpath);
|
||||
|
||||
// We're rotating the current log file, so reset the log message counter as well.
|
||||
m_LogMessageCount = 0;
|
||||
} catch (const std::exception& ex) {
|
||||
Log(LogCritical, "ApiListener")
|
||||
<< "Cannot rotate replay log file from '" << oldpath << "' to '"
|
||||
|
Loading…
x
Reference in New Issue
Block a user