initial commit of file from CVS for smeserver-audittools on Mon 10 Jul 08:35:16 BST 2023

This commit is contained in:
Brian Read
2023-07-10 08:35:16 +01:00
parent 0c3dab603b
commit e8ae5ac869
17 changed files with 877 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
#logcheck [days] [location]
re='^[0-9]+$'
days=2
location=/tmp
# If there is a second arg, use it as the location
if ! [ -z "$2" ]; then
location=$2
fi
# If first arg is a number, then set days.
if ! [ -z "$1" ]; then
if [[ $1 =~ $re ]] ; then
days=$1
else
location=$1
fi;
fi
echo "Log file: $location/log$(date +'%m%d%y')"
find /var/log/ -mtime -$days -print -exec sh -c 'cat "{}" | tai64nlocal | egrep -i "useless|warn|fail|error|disable|remov|unable|exit"' \; > "$location/log$(date +'%m%d%y')" 2>&1
exit 0