Increase max debug.log file size to 100MB

ZEC took the route of disabling this by default, so debug.log files grow without limit,
in attempt to gather more data about CVE-2019-16930, which was fixed in the same emergency
release as changing this default behavior.

KMD has chosen to ignore that ZEC change, which I find reasonable. We take the middle path,
and 10X increase the size limit.

Now debug.log must hit 100MB to be resized, and potentially lose some data about attacks.
This commit is contained in:
Duke Leto
2019-12-15 19:53:49 -05:00
parent 22cb700e06
commit f3091936e1

View File

@@ -892,7 +892,8 @@ void ShrinkDebugFile()
// Scroll debug.log if it's getting too big
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
FILE* file = fopen(pathLog.string().c_str(), "r");
if (file && boost::filesystem::file_size(pathLog) > 10 * 1000000)
unsigned int MAX_DEBUG_LOG_SIZE = 100*(1024*1024); // 100MB
if (file && boost::filesystem::file_size(pathLog) > MAX_DEBUG_LOG_SIZE )
{
// Restart the file with some of the end
std::vector <char> vch(200000,0);