diff --git a/etc/clamav-milter.conf.sample b/etc/clamav-milter.conf.sample index 1997f7341..b7d66a4f9 100644 --- a/etc/clamav-milter.conf.sample +++ b/etc/clamav-milter.conf.sample @@ -225,7 +225,8 @@ Example # Value of 0 disables the limit. # You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) # and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size -# in bytes just don't use modifiers. +# in bytes just don't use modifiers. If LogFileMaxSize is enabled, log +# rotation (the LogRotate option) will always be enabled. # # Default: 1M #LogFileMaxSize 2M @@ -251,7 +252,7 @@ Example # Default: no #LogVerbose yes -# Enable log rotation. +# Enable log rotation. Always enabled when LogFileMaxSize is enabled. # Default: no #LogRotate yes diff --git a/etc/clamd.conf.sample b/etc/clamd.conf.sample index 8d22eb44e..c3889d046 100644 --- a/etc/clamd.conf.sample +++ b/etc/clamd.conf.sample @@ -25,7 +25,8 @@ Example # Value of 0 disables the limit. # You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) # and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size -# in bytes just don't use modifiers. +# in bytes just don't use modifiers. If LogFileMaxSize is enabled, log +# rotation (the LogRotate option) will always be enabled. # Default: 1M #LogFileMaxSize 2M @@ -51,7 +52,7 @@ Example # Default: no #LogVerbose yes -# Enable log rotation. +# Enable log rotation. Always enabled when LogFileMaxSize is enabled. # Default: no #LogRotate yes diff --git a/etc/freshclam.conf.sample b/etc/freshclam.conf.sample index 06f5506f8..d2ea3d14d 100644 --- a/etc/freshclam.conf.sample +++ b/etc/freshclam.conf.sample @@ -20,7 +20,8 @@ Example # Value of 0 disables the limit. # You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) # and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). -# in bytes just don't use modifiers. +# in bytes just don't use modifiers. If LogFileMaxSize is enabled, +# log rotation (the LogRotate option) will always be enabled. # Default: 1M #LogFileMaxSize 2M @@ -41,7 +42,7 @@ Example # Default: LOG_LOCAL6 #LogFacility LOG_MAIL -# Enable log rotation. +# Enable log rotation. Always enabled when LogFileMaxSize is enabled. # Default: no #LogRotate yes diff --git a/shared/output.c b/shared/output.c index 80f59710b..70a3d3936 100644 --- a/shared/output.c +++ b/shared/output.c @@ -214,34 +214,25 @@ static int rename_logg(STATBUF *sb) if (!logg_rotate) { if (logg_fp) { fprintf(logg_fp, "Log size = %u, max = %u\n", sb->st_size, logg_size); - fprintf(logg_fp, "LOGGING DISABLED (Maximal log file size exceeded).\n"); - fclose(logg_fp); - logg_fp = NULL; + fprintf(logg_fp, "WARNING: Log size limit met but log file rotation turned off. Forcing log file rotation anyways.\n"); } - logg_file = NULL; - return 0; + logg_rotate = 1; } rotate_file_len = strlen(logg_file) + sizeof("-YYYY-MM-DD_HH:MM:SS"); rotate_file = calloc(1, rotate_file_len + 1); if (!rotate_file) { - if (logg_fp) { + if (logg_fp) fprintf(logg_fp, "Need to rotate log file due to size but ran out of memory.\n"); - fclose(logg_fp); - logg_fp = NULL; - } return -1; } t = time(NULL); if (!localtime_r(&t, &tmp)) { - if (logg_fp) { + if (logg_fp) fprintf(logg_fp, "Need to rotate log file due to size but could not get local time.\n"); - fclose(logg_fp); - logg_fp = NULL; - } free(rotate_file); return -1;