I'm working on a script that logs messages using rsyslog, and I want to calculate the total size of log entries (traces) generated per minute. My rsyslog configuration is set up to rotate logs based on size, as follows:
Example rsyslog configuration
. /var/log/termlog.log termLog 1000000 When the termlog.log file reaches 1,000,000 bytes, it rotates and new traces are written to termlog.log0. Consequently, I need to account for log entries in both termlog.log0 and termlog.log1, especially when the rotation occurs.
Objectives: Calculate the total size of traces logged per minute. Ensure that I account for log entries in both termlog.log, termlog.log0, and termlog.log1 when the rotation is near. Questions: How can I measure the size of log entries per minute in this scenario? What’s the best way to efficiently read the contents of termlog.log, termlog.log0, and termlog.log1 to include their sizes in my calculations?