diff --git a/rootfs/etc/default/logrotate.conf b/rootfs/etc/default/logrotate.conf index 6868723..3b872fc 100644 --- a/rootfs/etc/default/logrotate.conf +++ b/rootfs/etc/default/logrotate.conf @@ -1,5 +1,5 @@ /var/log/radar1090 { rotate 0 - size 25k + size 10k copytruncate } diff --git a/rootfs/etc/s6-overlay/scripts/radar1090 b/rootfs/etc/s6-overlay/scripts/radar1090 index 330ba92..7a1417e 100755 --- a/rootfs/etc/s6-overlay/scripts/radar1090 +++ b/rootfs/etc/s6-overlay/scripts/radar1090 @@ -73,7 +73,7 @@ if ! valid_ip "$beast_host"; then chk_enabled "$VERBOSE" && "${s6wrap[@]}" --args echo "BEASTHOST (\"${BEASTHOST:-ultrafeeder}\") successfully resolved to $beast_host" || true fi -RADAR_BIN=(/usr/sbin/radar) +RADAR_BIN=(stdbuf -oL /usr/sbin/radar) RADAR_CMD=("-b") RADAR_CMD+=("-k ${RADAR1090_KEY}") diff --git a/rootfs/etc/s6-overlay/scripts/radar1090-log b/rootfs/etc/s6-overlay/scripts/radar1090-log index 328e7e1..c844fb9 100755 --- a/rootfs/etc/s6-overlay/scripts/radar1090-log +++ b/rootfs/etc/s6-overlay/scripts/radar1090-log @@ -58,6 +58,10 @@ while true; do readarray -t loglines <<< "$(tail -"$WAITTIME" "$LOGFILE")" # Immediately clear logs: logrotate -f /etc/default/logrotate.conf + # see if we need to clean up the last loglines entry because often it's incomplete + if [[ -z "$(awk '{ print $11 }' <<< "${loglines[-1]}")" ]]; then + unset 'loglines[-1]' + fi # Now parse some statistics: packets=("$(awk '{ print $3 }' <<< "$(printf "%s\n" "${loglines[@]}")")")