Skip to content

Commit

Permalink
more logging beautification
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed Oct 23, 2023
1 parent 80ce1aa commit e83f013
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rootfs/etc/default/logrotate.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/var/log/radar1090 {
rotate 0
size 25k
size 10k
copytruncate
}
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/radar1090
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
4 changes: 4 additions & 0 deletions rootfs/etc/s6-overlay/scripts/radar1090-log
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}")")")
Expand Down

0 comments on commit e83f013

Please sign in to comment.