Skip to content

Commit fa2318e

Browse files
lipxumssonicbld
authored andcommitted
update rsyslog log size conf (sonic-net#15821)
Why I did it For some devices whose log folder size is larger than 200M, for example, 256M, the LOG_FILE_ROTATE_SIZE_KB should be 16M. and THRESHOLD_KB=$((USABLE_SPACE_KB - (NUM_LOGS_TO_ROTATE * LOG_FILE_ROTATE_SIZE_KB * 2))) = $(( (VAR_LOG_SIZE_KB * 90 / 100) - RESERVED_SPACE_KB)) - (NUM_LOGS_TO_ROTATE * LOG_FILE_ROTATE_SIZE_KB * 2))) = $(( (256M * 90 / 100) - 4096)) - (8 * 16M * 2))) the result would be a negative value Work item tracking Microsoft ADO (number only): 24524827 How I did it Add a case for 400M, if the log folder size is between 200M and 400M, set the log file size to 2M How to verify it Do cmd "sudo logrotate -f /etc/logrotate.conf" on DUT which val/log folder size is 256M, and check the syslog.
1 parent 826f5a1 commit fa2318e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

files/image_config/logrotate/rsyslog.j2

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
{
3737
{% if var_log_kb <= 204800 %}
3838
size 1M
39+
{% elif var_log_kb <= 409600 %}
40+
size 2M
3941
{% else %}
4042
size 16M
4143
{% endif %}
@@ -52,6 +54,8 @@
5254
# Adjust LOG_FILE_ROTATE_SIZE_KB to reflect the "size" parameter specified above, in kB
5355
{% if var_log_kb <= 204800 %}
5456
LOG_FILE_ROTATE_SIZE_KB=1024
57+
{% elif var_log_kb <= 409600 %}
58+
LOG_FILE_ROTATE_SIZE_KB=2048
5559
{% else %}
5660
LOG_FILE_ROTATE_SIZE_KB=16384
5761
{% endif %}

0 commit comments

Comments
 (0)