[System logs]: Dynamically calculate file rotation thresholds based on /var/log/ partition size#851
[System logs]: Dynamically calculate file rotation thresholds based on /var/log/ partition size#851jleveque wants to merge 11 commits intosonic-net:masterfrom jleveque:improve_syslog
Conversation
There was a problem hiding this comment.
I think / in bash is integer division. Shall we move * to the left of /100 to minimize truncation error?
There was a problem hiding this comment.
Thanks. I reordered the operations to not only reduce the truncation, but also to make the operations more understandable.
There was a problem hiding this comment.
If we have a lot of variables, another way is to save data into a json file and load in sonic-cfggen with -j. Not a big difference with -a, though.
There was a problem hiding this comment.
Thanks for the info. I think this solution is fine for the three variables. If it grows more, I'll keep that idea in mind.
|
|
… filling disk space
…hether since logrotate is run every minute
partition size - Also rename /etc/logrotate.d/rsyslog to /etc/logrotate.d/sonic, as SwSS logs are not managed by rsyslog - Add modified default /etc/logrotate.conf to ensure btmp and wtmp files are rotated based on size
…all files in /etc/logrotate.d/
…order to overwrite the default file
| daily | ||
| maxsize 50M | ||
| rotate 1 | ||
| size 10k |
There was a problem hiding this comment.
10k [](start = 9, length = 3)
is 10k a good value for auth.log?
|
|
||
| SIZE_LIMIT_SYSLOG_FILES_KB=$(((USABLE_SPACE_KB * PERCENT_ALLOCATED_SYSLOG / 100) / (NUM_LOG_FILES_SYSLOG * (NUM_ARCHIVES_PER_LOG_FILE + 1)))) | ||
| SIZE_LIMIT_QUAGGA_TEAMD_FILES_KB=$(((USABLE_SPACE_KB * PERCENT_ALLOCATED_QUAGGA_TEAMD / 100) / (NUM_LOG_FILES_QUAGGA_TEAMD * (NUM_ARCHIVES_PER_LOG_FILE + 1)))) | ||
| SIZE_LIMIT_SWSS_FILES_KB=$(((USABLE_SPACE_KB * PERCENT_ALLOCATED_SWSS / 100) / (NUM_LOG_FILES_SWSS * (NUM_ARCHIVES_PER_LOG_FILE + 1)))) |
There was a problem hiding this comment.
what are the actual sizes when the log partition size is 100M?
for example syslog log size limit is 102400 * 75 / 100 / (1 * ( 7 + 1) = 9600KB.
swss size limit is 10240010/100/(2(7+1)) = 640KB
since, the gzipped archive is much smaller than the actual log size. we might end up with not fully utilizing the /var/log partition.
Ideally, if we can rotate based on the free disk size, we can utilize the /var/log partition. however, we need to modify logrotate for that.
there are some discussion in here. https://serverfault.com/questions/372809/free-space-driven-log-rotation-on-linux
|
Abandoning in favor of #865 |
Implement PSU API for Seastone2
…lly (sonic-net#851) #### Why I did it src/sonic-swss ``` * bb317bb - (HEAD -> 202412, origin/202412) [code sync] Merge code from sonic-net/sonic-swss:202411 to 202412 (#57) (21 hours ago) [mssonicbld] ``` #### How I did it #### How to verify it #### Description for the changelog
Uh oh!
There was an error while loading. Please reload this page.