PDA

View Full Version : Script to view access over the last two days


asktoby
19-03-2004, 14:23
I'm always curious how my server's being used. After turning on usage logging in server.ini ([log] access=1) I made the following script that greps server.log for a regex matching activity over the last 2 days.


echo "User activity over the last two days:"
cat server.log | egrep "`date -d yesterday +%d-%m-%y`|`date +%d-%m-%y`" | grep conn

asktoby
10-06-2004, 11:50
I made some improvements to make it more legible.
Just paste the following into a textfile in linux in the same directory as server.log and make it executable:


echo "This file created:"
date
echo "User activity over the last two days:"
cat server.log | egrep "`date -d yesterday +%d-%m-%y`|`date +%d-%m-%y`" | grep conn | sed -r 's/:[0-9]*,ALL,Info,AccessLog,\tSID: 1 client//g' | sed -r 's/Nick: //g' | sed -r 's/IP: [0-9]*.[0-9]*.[0-9]*.[0-9]*, //g' | sed -r 's/, Lo.*/]/g' | sed -r 's/ed\./ed/g'