aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-log-follow
blob: 33e558711bd57b3adc641218d8cd1947f1d8832d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
tail -f $AK_LOGSFILE | while read -r p || [ -n "$p" ]
do
    timestamp="$(echo "$p" | awk '{print $1}')"
    program="$(echo "$p" | awk '{print $2}')"
    messagetype="$(echo "$p" | awk '{print $3}')"
    message="$(echo "$p" | cut -d ' ' -f4-)"
    printf '%s \033[1;32m%s\033[0;00m \033[1;31m%s\033[0;00m %s\n' \
        "$(date --date=@$timestamp +%Y%m%d_%H%M%S)" \
        "$program" \
        "$messagetype" \
        "$message"
done