diff --git a/files/image_config/logrotate/rsyslog.j2 b/files/image_config/logrotate/rsyslog.j2 index 77d950eb4fd46..4c40da24d256c 100644 --- a/files/image_config/logrotate/rsyslog.j2 +++ b/files/image_config/logrotate/rsyslog.j2 @@ -85,7 +85,7 @@ if [ $USED_KB -lt $THRESHOLD_KB ]; then break else - OLDEST_ARCHIVE_FILE=$(find /var/log -type f -printf '%T+ %p\n' | grep -E '.+\.[0-9]+(\.gz)?$' | sort | head -n 1 | awk '{ print $2; }') + OLDEST_ARCHIVE_FILE=$(find /var/log -type f -printf '%T+ %p\n' | grep -E '.+\.[0-9]+(\.gz)?$' | sort | awk 'NR == 1 {print $2}') if [ -z "$OLDEST_ARCHIVE_FILE" ]; then logger -p syslog.err -t "logrotate" "No archive file to delete -- potential for filling up /var/log partition!"