blob: 48a27581f787e94778eb67aa41957d946be7e757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/env bash
set -e
LOGFILE=$1
mindate=$(head -n1 $LOGFILE | cut -f1 | cut -d'T' -f1)
maxdate=$(date --date="-6 days" -u -Id)
echo "Deleting log lines from ${mindate} to ${maxdate}"
sed -i -E "/${mindate}/,/${maxdate}/d" $LOGFILE
echo "Cleared logs"
|