if ! [ -d log ]; then
mkdir log
fi
month=${1:-$(LANG=en_US.UTF-8 date +"%-m" --date 'last month')}
searchmonth=$(LANG=en_US.UTF-8 date +"%b" --date "2009-$month-01")
IFS_DEF=$IFS
IFS="
"
for username in $(cut -d":" -f1 /etc/passwd); do
echo Host Name : $(hostname) > log/$username.log
echo User Name : $username >> log/$username.log
for wtmplist in $(ls -l /var/log/wtmp*); do
last -f $wtmplist \
| grep " $searchmonth " \
| grep "$username" >> log/$username.log
done
grep -h "^$searchmonth " /var/log/secure* \
| grep "$username" >> log/$username.log
done
IFS=$IFS_DEF