#!/usr/bin/env bash

set -e

cd $(dirname $(realpath $0))

ls *.log | cut -d- -f -2 | sort -u | head -n -1 | while read i; do
    echo "Compressing $i"
    cat $i-*.log | pigz -c9 > $i.log.gz
    rm $i-*.log
done
