fix: Tail start offset should be lines + 1

0 or 1 is equivalent for a fresh file, but when log lines already exist, you want to start from the line after the last one, not at it. Thus always increment the count by 1.
This commit is contained in:
Brennan Kinney 2024-08-02 13:45:31 +12:00 committed by GitHub
parent 4f1d075d43
commit 717bf7b434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -199,7 +199,7 @@ MAIN_LOGFILE=/var/log/mail/mail.log
# NOTE: rsyslogd would usually create this later during `_start_daemons`, however it would already exist if the container was restarted.
touch "${MAIN_LOGFILE}"
# Ensure `tail` follows the correct position of the log file for this container start (new logs begin once `_start_daemons` is called)
TAIL_START=$(wc -l < "${MAIN_LOGFILE}")
TAIL_START=$(( $(wc -l < "${MAIN_LOGFILE}") + 1 ))
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
_start_daemons