Skip to content

Commit

Permalink
Pin max size of logging to static value
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
  • Loading branch information
fastiuk committed Apr 27, 2024
1 parent 4d9b427 commit 7f89174
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions files/image_config/logrotate/logrotate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ NUM_LOGS_TO_ROTATE=10

# Detect common log files (auth, cron, teamd, telemetry, etc.) size. 720M is
# required to hold extra space to rotate all files (16M each) two times.
if [[ "$VAR_LOG_SIZE" < "737280" ]]; then
if [[ "$VAR_LOG_SIZE" < "204800" ]]; then
LOG_FILE_ROTATE_SIZE_MB=1
elif [[ "$VAR_LOG_SIZE" < "1474560" ]]; then
elif [[ "$VAR_LOG_SIZE" < "409600" ]]; then
LOG_FILE_ROTATE_SIZE_MB=2
else
LOG_FILE_ROTATE_SIZE_MB=16
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/logrotate/templates/logrotate-debug.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% set frequency = debug.frequency | d(def_logging.common.frequency) -%}
{% set max_number = debug.max_number | d(def_logging.debug.max_number) -%}

{% if debug.disk_percentage -%}
{% if debug.disk_percentage and not debug.size -%}
{% set size_mb = (max_logs_size_kb | int) *
(debug.disk_percentage | float) / 100 / 1024 -%}
{% else -%}
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/logrotate/templates/logrotate-syslog.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% set frequency = syslog.frequency | d(def_logging.common.frequency) -%}
{% set max_number = syslog.max_number | d(def_logging.syslog.max_number) -%}

{% if syslog.disk_percentage -%}
{% if syslog.disk_percentage and not syslog.size -%}
{% set size_mb = (max_logs_size_kb | int) *
(syslog.disk_percentage | float) / 100 / 1024 -%}
{% else -%}
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,8 @@
},
"dpu1": {
"midplane_interface": "dpu1"
}
},
"LOGGING": {
"debug": {
"disk_percentage": "46.0",
Expand Down

0 comments on commit 7f89174

Please sign in to comment.