Computer and IT knowledge - things to know
---------------- sample output if you execute the script -------------
./countRadiusLogin.sh
0 radius_auth count=15661 Radius Authentication counts per day (15661)
0 radius_auth_success count=2 Successful Radius Authentication counts per day (2)
0 radius_auth_failed count=15659 Failed Radius Authentication counts per day (15651)
---------------------- script -------------------
#!/bin/bash
logfile='/var/log/radius/radius.log'
month=`date +"%h"`
month=`LC_TIME="en_US.UTF-8" date +"%b"`
day=`date +"%-d"`
if [ $day -lt 10 ]
then
blank=" "
else
blank=""
fi
countAll=`cat $logfile | grep "authentication request for user" | grep "$month $blank$day" |wc -l `
countSuccess=`cat $logfile | grep "Success - User" | grep "$month $blank$day" |wc -l `
countFailed=`cat $logfile | grep "Denied access" | grep "$month $blank$day" |wc -l `
echo "0 radius_auth count=$countAll Radius Authentication counts per day ($countAll)"
echo "0 radius_auth_success count=$countSuccess Successful Radius Authentication counts per day ($countSuccess)"
echo "0 radius_auth_failed count=$countFailed Failed Radius Authentication counts per day ($countFailed)"
computer2know :: thank you for your visit :: have a nice day :: © 2024