#!/bin/bash

log="/var/log/cocaine-core/cocaine-tskv.log"

timetail -n 10860 -t tskv ${log} | fgrep 'success=false' | fgrep -cv -e ConvertUserException -e UserException -e PasswordProtectedException -e ArchiveExtractException -e IllegalArgumentException -e FileTooBigUserException | sed 's/^/stage_errors\ /' || echo "stage_errors"
timetail -n 10860 -t tskv ${log} | fgrep 'success=false' | fgrep -c -e ConvertUserException -e UserException -e PasswordProtectedException -e ArchiveExtractException -e IllegalArgumentException -e FileTooBigUserException | sed 's/^/other_stage_errors\ /' || echo "other_stage_errors"

