PDA

View Full Version : Bash script to filter logins from log files


cubber
12-15-2009, 08:15 PM
I created this simple script so that I could parse the log files to see login activity on the server from the command line on the server.

The script parses the eqemu_debug_world.log file and returns a list of account names as well as date and time that they logged in.

Change the logfile="" line to point to your log file location.


#!/bin/bash

logfile="/opt/eqemu/logs/eqemu_debug_world.log";

grep Logged $logfile | awk {'print $6, $2, $3, $4'}

exit



The output of the script looks like so:

accountname: [12.04. - 12:52:58]
accountname2: [12.06. - 16:35:49]
accountname: [12.07. - 20:45:52]
anotheraccountname: [12.07. - 20:47:54]


Enjoy!