Actions

Half Life Log Parsing

From Rabbi Blog

Revision as of 01:50, 6 November 2007 by Rabbi Bob (talk | contribs)

Purpose

Awhile ago I started a project called "AtlasHL" and today while I was sick I decided to go back and look at some of the scripting I had done two years ago. Without too much detail, I did today in two hours what I did in about two months back then.

I'm not a regex guru by any stretch of the imagination and while there are better ways to do what I'm doing, I do actually have some reasons for breaking some specific log lines the way I do. Someday I'll learn efficiency, but for right now, I'm going through this in the worst way possible: stepped if/elsif statements until the end.

Current Status

  1. Generally just bashing lines through the regex. After I get through all of the logs I have, I'll look at categorizing a little better (and condensing some lines).
  2. Current ratio:
    1. 10,972 logs
    2. 114 unmatched lines (mostly repetitive)
    3. 2,619,859 matched lines

References

  1. http://developer.valvesoftware.com/wiki/HL_Log_Standard#054._Team_Selection

The HL Log Standard appears to be a little long in the tooth and hasn't been really updated and the adhering to it is loose at best depending on what game you're looking at. Tthis is my opinion, but I have nearly 100 thousand logs from various games & mods to back this up with.

Code

#!/usr/bin/perl -w
# Created by Rabbi-Bob

use strict;
use warnings;

my ($VERSION)="0.6B";
my ($LASTEDIT)="11/03/2007";
my ($EDIT)="Rabbi Bob";
my ($COPYRIGHT)="2007";
    
my($LOGDIR)="U:/Programs/atlashl/pb/oldlogs";
my($LOGFILE_IN)=();         #logfile input vars
my($FILE)=();
my(@FILES)=();
my($OUTPUT)=();                #output vars
my($missing)=();

my ($TODO_OUT)="todo.txt";
my ($DONE_OUT)="done.csv";

##################################
opendir(DIR, "$LOGDIR") or die "Cannot open $LOGDIR to read: $!";
@FILES = grep(/\.log$/,readdir(DIR));
closedir(DIR);

open (TODO_OUT, ">$TODO_OUT") or die "Cannot open $TODO_OUT to output: $!";
open (DONE_OUT, ">$DONE_OUT") or die "Cannot open $DONE_OUT to output: $!";

print DONE_OUT "EventID,LogLine\n";

@FILES = sort (@FILES); # reverse the array

my $lineno = 0; # The line number in the log file

foreach $FILE (@FILES) 
    {
	$LOGFILE_IN="$LOGDIR/$FILE";
	
    my $LOGLINE=();
    
    ########### Open Logfile for reading ############################################
	#open the input file
	open LOGFILE_IN, $LOGFILE_IN or die "Cannot open $LOGFILE_IN for read :$!";
	print "scanning $LOGFILE_IN\n";
    ######################################################################
        while (<LOGFILE_IN>)
	    {
        $lineno++; # increment the line number primarily for debugging
	    $LOGLINE=$_;
	    ##### Log File Comment #####

        #L 05/11/2007 - 06:45:28: Server cvars start
        if ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Server cvars start/i)
            {
            print DONE_OUT "001A,$_";
            }
        #L 05/11/2007 - 06:45:28: Server cvars end
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Server cvars end/i)
            {
            print DONE_OUT "001B,$_";
            }
        #L 05/11/2007 - 06:45:28: Server cvar "_tutor_bomb_viewable_check_interval" = "0.5"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Server cvar \"(.*)\" = \"(.*)\"/)
            {
            print DONE_OUT "001C,$_";
            }
        #L 11/03/2007 - 18:12:22: server_cvar: "sv_accelerate" "5"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): server_cvar: \"(.*)\" \"(.*)\"/)
            {
            print DONE_OUT "001D,$_";
            }          
        #L 11/03/2007 - 20:46:17: "r_AirboatViewDampenFreq" = "7.0"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" = \"(.*)\"/)
            {
            print DONE_OUT "001D,$_";
            }          
        #L 05/11/2007 - 06:45:28: Log file started (file "logs\L0511019.log") (game "cstrike") (version "47/1.1.2.5/3647")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Log file started \(file \"(.*)\"\) \(game \"(.*)\"\) \(version \"(.*)\"\)/)
            {
            print DONE_OUT "002A,$_";
            }
        #L 05/11/2007 - 07:11:12: Log file closed
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Log file closed/)
            {
            print DONE_OUT "002B,$_";
            }
        #L 10/30/2007 - 10:11:25: server_message: "quit"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): server_message: \"(.*)\"/)
            {
            print DONE_OUT "002C,$_";
            }        
        #L 07/08/2007 - 03:29:10: Server shutdown    
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Server shutdown/)
            {
            print DONE_OUT "002C,$_";
            }                
        #L 05/11/2007 - 06:45:28: Loading map "de_dust"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Loading map \"(.*)\"/)
            {
            print DONE_OUT "003A,$_";
            }
        #L 05/11/2007 - 06:45:30: Started map "de_dust" (CRC "-1641307065")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Started map \"(.*)\" \(CRC \"(.*)\"\)/)
            {
            print DONE_OUT "003B,$_";
            }
        #L 04/25/2007 - 08:30:44: Bad Rcon: "rcon 578394037 "password" changelevel de_dust " from "65.175.222.9:61147"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Bad Rcon: \"(.*) \"(.*)\" (.*)\" from \"(.*)\"/)
            {
            print DONE_OUT "004B,$_";
            }
        
        #L 10/29/2007 - 23:23:24: rcon from "70.91.92.66:1941": command "log on"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): rcon from \"(.*)\": command \"(.*)\"/)
            {
            print DONE_OUT "004C,$_";
            }
        #L 05/06/2005 - 21:27:47: Rcon: "rcon 4018452088 "toyota" log" from "24.253.156.83:7130"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Rcon: \"(.*) \"(.*)\" (.*)\" from \"(.*)\"/)
            {
            print DONE_OUT "004D,$_";
            }
        #L 11/04/2007 - 20:25:34: rcon from "66.30.92.200:2058": Bad Password
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): rcon from \"(.*)\": Bad Password/)
            {
            print DONE_OUT "004E,$_";
            }        
        #L 10/28/2007 - 20:39:28: [META] dll: Updating plugins...
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[META|CSTRIKE|CSX|FUN\] (.*)/)
            {
            print DONE_OUT "007A,$_";
            }
        #L 11/04/2007 - 01:44:28: "FoCA|LocoYokel<158><STEAM_ID_PENDING><>" connected, address "72.177.119.42:12381"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" connected, address \"(.*)\"/)
            {
            print DONE_OUT "050A,$_";
            }
        #L 11/04/2007 - 02:00:04: "-Ðinosaur<161><STEAM_0:1:3908269><>" STEAM USERID validated
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" STEAM USERID validated/)
            {
            print DONE_OUT "050B,$_";
            }
        #L 11/02/2007 - 23:50:41: "FoCA|rochvegas j<9><STEAM_0:0:63048><>" entered the game
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" entered the game$/)
            {
            print DONE_OUT "051A,$_";
            }
        #L 11/04/2007 - 01:44:12: "violeNt| Conen.<157><STEAM_0:0:5752133><TERRORIST>" disconnected (reason "Disconnect by user.")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): "(.*)" disconnected \(reason \"(.*)\"/)
            {
            print DONE_OUT "052A,$_";
            }
        #L 05/11/2007 - 06:46:43: "(* ) ( *)<1><STEAM_0:1:273255><>" disconnected
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): "(.*)" disconnected$/)
            {
            print DONE_OUT "052A,$_";
            }
        #L 10/28/2007 - 21:28:34: Kick: "Ciggarette  / Gago<202><STEAM_0:1:15378592><>" was kicked by "Console"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Kick: "(.*)" was kicked by \"(.*)\"/)
            {
            print DONE_OUT "052B,$_";
            }
        #L 05/11/2007 - 06:45:30: Ban: "<><STEAM_0:0:1004474><>" was banned "permanently" by "Console"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Ban: "(.*)" was banned \"(.*)\" by \"(.*)\"/)
            {
            print DONE_OUT "052C,$_";
            }
        #L 05/20/2007 - 21:54:31: Ban: "VZLA.milk<192><STEAM_0:1:14553521><>" was kicked and banned "for 5.00 minutes" by "Console"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Ban: "(.*)" was kicked and banned \"(.*)\" by \"(.*)\"/)
            {
            print DONE_OUT "052D,$_";
            }        
        
        #L 11/03/2007 - 23:41:06: "FoCA| TADMG<113><STEAM_0:0:85065><TERRORIST>" disconnected (reason "No Steam logon
        ###CS:S output appears to include a line carriage when announcing STEAM account issues###
        
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): "(.*)" disconnected \(reason \"(.*)$/)
            {
            print DONE_OUT "052A,$_";
            }            
        ##L 11/03/2007 - 01:44:44: Banid: "<><STEAM_0:1:9283492><>" was banned "permanently" by "Console"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Banid: "(.*)" was banned \"(.*)\" by \"(.*)\"/)
            {
            print DONE_OUT "052D,$_";
            }
        #L 11/03/2007 - 00:03:32: "FoCA|BigE[GH]<18><STEAM_0:0:28458><CT>" committed suicide with "hegrenade"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" committed suicide with \"(.*)\"/)
            {
            print DONE_OUT "053A,$_";
            }
        #L 11/02/2007 - 23:50:46: "FoCA|BigE[GH]<18><STEAM_0:0:28458><Unassigned>" joined team "CT"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" joined team \"(.*)\"/)
            {
            print DONE_OUT "054A,$_";
            }
        #L 05/02/2005 - 21:45:01: "FoCA|Rolyak<986><STEAM_0:1:72275><Axis>" changed role to "#class_axis_k43"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" changed role to \"(.*)\"/)
            {
            print DONE_OUT "055A,$_";
            }
        #L 11/03/2007 - 01:59:19: "Anarico<42><STEAM_0:1:412737><CT>" changed name to "FoCA|Anarico"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" changed name to \"(.*)\"/)
            {
            print DONE_OUT "056A,$_";
            }
        #L 11/02/2007 - 23:54:24: "FoCA|BigE[GH]<18><STEAM_0:0:28458><CT>" killed "Alice<8><STEAM_0:0:2357615><TERRORIST>" with "m4a1"    
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" killed \"(.*)\" with \"(.*)\"/)
            {
            print DONE_OUT "057A,$_";
            }
        #L 11/02/2007 - 23:54:24: "FoCA|BigE[GH]<18><STEAM_0:0:28458><CT>" killed "Alice<8><STEAM_0:0:2357615><TERRORIST>" with "m4a1" (headshot)
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" killed \"(.*)\" with \"(.*)\" \((.*)\)/)
            {
            print DONE_OUT "057B,$_";
            }
        #L 11/02/2007 - 23:52:36: "FoCA|Rabbi Bob<17><STEAM_0:1:273255><TERRORIST>" triggered "Got_The_Bomb"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" triggered \"(.*)\"/)
            {
            print DONE_OUT "060A,$_";
            }
        #L 05/02/2005 - 21:47:06: "FoCA|Rolyak<986><STEAM_0:1:72275><Allies>" triggered a "dod_capture_area" - "POINT_AVALANCHE_AXISGUNPOSITION"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" triggered a \"(.*)\" - \"(.*)\"/)
            {
            print DONE_OUT "060BA,$_";
            }
        #L 11/03/2007 - 00:51:39: Team "TERRORIST" triggered "Target_Bombed" (CT "0") (T "0")
        #L 05/11/2007 - 06:50:22: Team "CT" triggered "Target_Saved" (CT "1") (T "0")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Team \"(.*)\" triggered \"(.*)\" \(CT \"(.*)\"\) \(T \"(.*)\"\)/)
            {
            print DONE_OUT "061A,$_";
            }
        #L 11/03/2007 - 00:06:35: Team "CT" triggered "CTs_Win" (CT "12") (T "6")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Team \"(.*)\" triggered \"(.*)\" \(CT \"(.*)\"\) \(T \"(.*)\"\)/)
            {
            print DONE_OUT "061B,$_";
            }
        #L 05/02/2005 - 21:47:06: Team "Allies" triggered a "dod_capture_area" - "POINT_AVALANCHE_AXISGUNPOSITION"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Team \"(.*)\" triggered a \"(.*)\" - \"(.*)\"/)
            {
            print DONE_OUT "061C,$_";
            }
        #L 05/11/2007 - 06:46:52: World triggered "Round_Start"
        #L 05/11/2007 - 06:46:43: World triggered "Round_End"
        #L 11/02/2007 - 23:50:47: World triggered "Game_Commencing"            
        #L 11/04/2007 - 02:06:26: World triggered "Intermission_Time_Limit"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): World triggered \"(.*)\"$/)
            {
            print DONE_OUT "062A,$_";
            }
       #L 05/11/2007 - 06:46:43: World triggered "Round_Draw" (CT "0") (T "0")
       #L 04/21/2007 - 07:43:18: World triggered "Game_Commencing" (CT "0") (T "0")

        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): World triggered \"(.*)\" \(CT \"(.*)\"\) \(T \"(.*)\"\)/)
            {
            print DONE_OUT "062B,$_";
            }

        #L 11/04/2007 - 01:48:19: "FoCA|LocoYokel<158><STEAM_0:0:4864772><CT>" say "test"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" say \"(.*)\"/)
            {
            print DONE_OUT "063A,$_";
            }
        #L 11/04/2007 - 01:52:25: "[CoFR]FoxyFire<156><STEAM_0:0:1362382><CT>" say_team "go back door"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" say_team \"(.*)\"/)
            {
            print DONE_OUT "063B,$_";
            }
        #L 05/11/2007 - 07:11:12: Team "CT" scored "6" with "0" players
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Team \"(.*)\" scored \"(.*)\" with \"(.*)\" players/)
            {
            print DONE_OUT "065A,$_";
            }
        #L 05/02/2005 - 21:47:37: "Allies" scored "55" with "2" players
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" scored \"(.*)\" with \"(.*)\" players/)
            {
            print DONE_OUT "065A,$_";
            }

############### AMXMODX ####################
        #L 10/28/2007 - 21:23:17: [admincmd.amxx] Cmd: "[FoCA|CoFR]Barnes<189><STEAM_0:1:343958><>" changelevel "de_dust2"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" changelevel \"(.*)\"/)
            {
            print DONE_OUT "A03A,$_";
            }            
        #L 06/03/2007 - 23:48:29: [admincmd.amxx] Cmd: "Simple Daddy<305><STEAM_0:1:215772><>" set cvar (name "sv_gravity") (value "200")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" set cvar \(name \"(.*)\"\) \(value \"(.*)\"\)/)
            {
            print DONE_OUT "A03A,$_";
            }            

        #L 10/28/2007 - 20:41:06: [admincmd.amxx] Cmd: "FoCA|LocoYokel[GH]<141><STEAM_0:0:4864772><>" ask for players list
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" ask for players list/)
            {
            print DONE_OUT "A07A,$_";
            }            
        
        #L 05/11/2007 - 06:46:18: [admin.amxx] Login: "(* ) ( *)<1><STEAM_0:1:273255><>" became an admin (account "STEAM_0:1:273255") (access "bcdefghijklmnopqrstu") (address "76.179.90.224")

        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admin.amxx\] Login: \"(.*)\" became an admin \(account \"(.*)\"\) \(access \"(.*)\"\) \(address \"(.*)\"\)/)
            {
            print DONE_OUT "A50A,$_";
            }
        #L 10/28/2007 - 21:28:34: [plmenu.amxx] Kick: "FoCA|rochvegas j + astigmatism<192><STEAM_0:0:63048><>" kick "Ciggarette  / Gago<202><STEAM_0:1:15378592><>"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[plmenu.amxx\] Kick: \"(.*)\" kick \"(.*)\"/)
            {
            print DONE_OUT "A52B,$_";
            }                    
        #L 06/17/2007 - 22:23:51: [admincmd.amxx] Kick: "FoCA|DRB<114><STEAM_0:0:400966><>" kick "|8|r90|Prim3[martyr]<143><STEAM_0:1:2487360><>" (reason "")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Kick: \"(.*)\" kick \"(.*)\" \(reason \"(.*)\"\)/)
            {
            print DONE_OUT "A52C,$_";
            }                    
        #L 06/19/2007 - 21:58:00: [admincmd.amxx] Ban: "FoCA|DRB<417><STEAM_0:0:400966><>" ban and kick "cl_utch<433><STEAM_0:1:9428559><>" (minutes "0") (reason "")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Ban: \"(.*)\" ban and kick \"(.*)\" \(minutes \"(.*)\"\) \(reason \"(.*)\"\)/)
            {
            print DONE_OUT "A52C,$_";
            }                    
        #L 10/29/2007 - 01:12:55: [plmenu.amxx] Ban: "FoCA|LocoYokel[GH]<241><STEAM_0:0:4864772><>" ban and kick "Ctb  SSay<266><STEAM_0:1:13406436><>" (minutes "5")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[plmenu.amxx\] Ban: \"(.*)\" ban and kick \"(.*)\" \(minutes \"(.*)\"\)/)
            {
            print DONE_OUT "A52C,$_";
            }                    
        #L 05/20/2007 - 17:32:19: [plmenu.amxx] Cmd: "FoCA|OGWG Persecutor<51><STEAM_0:0:266906><>" transfer "xDf<69><STEAM_0:1:14332828><>" (team "TERRORIST")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[plmenu.amxx\] Cmd: \"(.*)\" transfer \"(.*)\" \(team \"(.*)\"\)/)
            {
            print DONE_OUT "A54A,$_";
            }              
        #L 10/28/2007 - 22:10:11: [admincmd.amxx] Cmd: "FoCA|rochvegas j + astigmatism<192><STEAM_0:0:63048><>" change nick to "roch's slave" "Player<213><STEAM_0:1:15118437><>"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" change nick to \"(.*)\" \"(.*)\"/)
            {
            print DONE_OUT "A56A,$_";
            }                    
        #L 10/28/2007 - 21:12:41: [plmenu.amxx] Cmd: "FoCA|LocoYokel[GH]<141><STEAM_0:0:4864772><>" slay "[.icC.]Duke Nukem<183><STEAM_0:1:13910450><>"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[plmenu.amxx\] Cmd: \"(.*)\" slay \"(.*)\"/)
            {
            print DONE_OUT "A57A,$_";
            }                    
        #L 06/20/2007 - 21:28:12: [admincmd.amxx] Cmd: "FoCA|LocoYokel[GH]<121><STEAM_0:0:4864772><>" slay "LCC Tank<125><STEAM_0:1:13068210><>"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" slay \"(.*)\"/)
            {
            print DONE_OUT "A57A,$_";
            }                    
        #L 10/28/2007 - 21:36:12: [admincmd.amxx] Cmd: "[FoCA|CoFR]Barnes<189><STEAM_0:1:343958><>" slap with 0 damage "FoCA|Senser<203><STEAM_0:0:261108><>"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" slap with (.*) damage \"(.*)\"/)
            {
            print DONE_OUT "A57B,$_";
            }                     
        #L 10/28/2007 - 20:42:41: [plmenu.amxx] Cmd: "FoCA|Rizzo<180><STEAM_0:0:8245642><>" slap with 0 damage "FoCA|Fullthrottle<160><STEAM_0:1:386955><>"            
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[plmenu.amxx\] Cmd: \"(.*)\" slap with (.*) damage \"(.*)\"/)
            {
            print DONE_OUT "A57C,$_";
            }                             
        #L 08/26/2007 - 18:12:02: [admincmd.amxx] Cmd: "FoCA|Chronik[BB]<151><STEAM_0:1:2643832><>" server console (cmdline "sv_alltalk 3")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[admincmd.amxx\] Cmd: \"(.*)\" server console \(cmdline \"(.*)\"\)/)
            {
            print DONE_OUT "A57D,$_";
            }             
        
        #L 10/28/2007 - 20:39:49: [adminchat.amxx] Chat: "FoCA|LocoYokel[GH]<141><STEAM_0:0:4864772><>" chat " who changed it?"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminchat.amxx\] Chat: \"(.*)\" chat \"(.*)\"/)
            {
            print DONE_OUT "A63A,$_";
            }            
        #L 10/28/2007 - 20:43:30: [adminchat.amxx] Chat: "FoCA|LocoYokel[GH]<141><STEAM_0:0:4864772><>" tsay "hey RB"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminchat.amxx\] Chat: \"(.*)\" tsay \"(.*)\"/)
            {
            print DONE_OUT "A63B,$_";
            }    
        #L 05/14/2007 - 23:36:46: [adminchat.amxx] Chat: "FoCA|LocoYokel[GH]<21><STEAM_0:0:4864772><>" csay "Friendly fire is on, verify your targets and do not shoot teammates.  Offenders WILL be kicked."
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminchat.amxx\] Chat: \"(.*)\" csay \"(.*)\"/)
            {
            print DONE_OUT "A63C,$_";
            }              
        #L 05/16/2007 - 22:13:37: [adminchat.amxx] Chat: "FoCA|mother_goose<342><STEAM_0:1:265230><>" psay "FoCA|MudBone[GH]<337><STEAM_0:1:717421><>" "hey"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminchat.amxx\] Chat: \"(.*)\" psay \"(.*)\" \"(.*)\"/)
            {
            print DONE_OUT "A63D,$_";
            }              

        #L 05/16/2007 - 22:24:30: [adminvote.amxx] Vote: "FoCA|mother_goose<342><STEAM_0:1:265230><>" vote custom (question "should loco learn how to do an actual vote?") (option#1 "yes") (option#2 "no")

        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminvote.amxx\] Vote: \"(.*)\" vote custom \(question \"(.*)\"\) \(option#1 \"(.*)\"\) \(option#2 \"(.*)\"\)/)
            {
            print DONE_OUT "A80A,$_";
            }              
        #L 06/04/2007 - 18:33:37: [adminvote.amxx] Vote: "FoCA|DRB<366><STEAM_0:0:400966><>" vote map (map "mindmaze")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminvote.amxx\] Vote: \"(.*)\" vote map \(map \"(.*)\"\)/)
            {
            print DONE_OUT "A80A,$_";
            }              
        #L 05/16/2007 - 22:24:42: [adminvote.amxx] Vote: Voting successful (got "10") (needed "1") (result "should loco learn how to do an actual vote? - yes")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[adminvote.amxx\] Vote: Voting successful \(got \"(.*)\"\) \(needed \"(.*)\"\) \(result \"(.*)\"\)/)
            {
            print DONE_OUT "A80B,$_";
            }             
        #L 07/18/2007 - 17:04:18: [mapsmenu.amxx] Cmd: "FoCA|Scorp<2><STEAM_0:0:7817668><>" changelevel "as_crazytank"
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapsmenu.amxx\] Cmd: \"(.*)\" changelevel \"(.*)\"/)
            {
            print DONE_OUT "A81B,$_";
            }       
        #L 05/12/2007 - 22:44:10: [mapchooser.amxx] Vote: Voting for the nextmap started
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapchooser.amxx\] Vote: Voting for the nextmap (.*)/)
            {
            print DONE_OUT "A81C,$_";
            }
        #L 06/04/2007 - 18:33:50: [adminvote.amxx] Vote: Result accepted            
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapchooser.amxx\] Vote: Result accepted/)
            {
            print DONE_OUT "A81C,$_";
            }
        #L 06/09/2007 - 01:27:43: [mapsmenu.amxx] Vote: Voting successful. Map will be changed to awp_city
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapchooser.amxx\] Vote: Voting successful. Map will be changed to (.*)/)
            {
            print DONE_OUT "A81C,$_";
            }            
        #L 10/28/2007 - 20:07:20: [mapsmenu.amxx] Vote: Result accepted
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapsmenu.amxx\] Vote: Result accepted/)
            {
            print DONE_OUT "A81C,$_";
            }
        #L 10/28/2007 - 20:07:18: [mapsmenu.amxx] Vote: Voting successful. Map will be changed to as_tundra
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[mapsmenu.amxx\] Vote: Voting successful. Map will be changed to (.*)/)
            {
            print DONE_OUT "A81C,$_";
            }     
################### STATS #################################

        #L 09/07/2007 - 04:25:12: "Koopa Koop<44><STEAM_0:0:63055><CT>" attacked "MM | lil [IRA]<49><STEAM_0:1:406035><CT>" with "grenade" (damage "77") (damage_armor "0") (health "23") (armor "0")
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \"(.*)\" attacked \"(.*)\" with \"(.*)\" \(damage \"(.*)\"\) \(damage_armor \"(.*)\"\) \(health \"(.*)\"\) \(armor \"(.*)\"\)/)
            {
            print DONE_OUT "B01A,$_";
            }                    
        #L 05/02/2005 - 23:04:49: Final Scores: Allies: 94   Axis: 476
        elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Final Scores: (.*): (.*) (.*): (.*)/)
            {
            print DONE_OUT "B01B,$_";
            }
################ MISC ADDONS #################

#L 05/14/2005 - 23:27:54: [ADMIN] IRONHAND has forgiven FoCA|Whatfer's TK.
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[ADMIN\] (.*) has forgiven (.*)\'s TK.$/)
            {
            print DONE_OUT "C01A,$_";
            }
#L 05/14/2005 - 23:28:24: [ADMIN] [CoFR]Keeve TK warning 1 of 3
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[ADMIN\] (.*) TK warning (.*) of (.*)$/)
            {
            print DONE_OUT "C01B,$_";
            }
#L 05/02/2005 - 22:08:50: [ADMIN] FoCA|moondance Slayed for teammate attack after respawn
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[ADMIN\] (.*) Slayed for teammate attack after respawn$/)
            {
            print DONE_OUT "C01C,$_";
            }
#L 05/05/2005 - 23:40:18: [ADMIN] Nix Slayed for violating 3 TK warning
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[ADMIN\] (.*) Slayed for violating (.*) TK warning$/)
            {
            print DONE_OUT "C01C,$_";
            }
#L 05/06/2005 - 21:13:04: [ADMIN] deiter Exceeded 3 TK limit and is BANNED for 1 minutes
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): \[ADMIN\] (.*) Exceeded (.*) TK limit and is BANNED for (.*) minutes$/)
            {
            print DONE_OUT "C01C,$_";
            }
#L 10/27/2007 - 08:07:31: Loaded 128 Maps into the maps that will be picked for the vote
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Loaded (.*) Maps into the maps that will be picked for the vote$/)
            {
            print DONE_OUT "C02A,$_";
            }
#L 09/13/2007 - 18:10:47: Nominations for the map vote: 0 out of 5 possible nominations
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Nominations for the map vote: (.*) out of (.*) possible nominations$/)
            {
            print DONE_OUT "C02A,$_";
            }
#L 09/13/2007 - 18:10:47: Randomly Filling slots for the vote with 5 out of 128
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Randomly Filling slots for the vote with (.*) out of (.*)$/)
            {
            print DONE_OUT "C02A,$_";
            }
#L 09/13/2007 - 18:10:47: Filled 5 vote slots with random maps, 5 are custom
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Filled (.*) vote slots with random maps, (.*) are custom$/)
            {
            print DONE_OUT "C02A,$_";
            }
#L 10/27/2007 - 07:19:39: Banned 1 Maps in your mapstoban.ini file
       elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Banned (.*) Maps in your mapstoban.ini file$/)
            {
            print DONE_OUT "C02B,$_";
            }
#L 10/27/2007 - 07:19:39: 1 Maps were not loaded because they were the last maps played, or defined twice, or banned
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): (.*) Maps were not loaded because they were the last maps played, or defined twice, or banned$/)
            {
            print DONE_OUT "C02C,$_";
            }
#L 10/27/2007 - 07:19:39: Found 12 Maps in your mapcycle.txt/allmaps.txt file, 7 are available for filling slots
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Found (.*) Maps in your mapcycle.txt\/allmaps.txt file, (.*) are available for filling slots$/)
            {
            print DONE_OUT "C02D,$_";
            }
#L 10/26/2007 - 06:09:27: Vote: Voting for the nextmap started
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Vote: Voting for the nextmap started$/)
            {
            print DONE_OUT "C02E,$_";
            }

#L 10/26/2007 - 06:09:47: Vote: Voting for the nextmap finished. The nextmap will be de_dust
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Vote: Voting for the nextmap finished. The nextmap will be (.*)$/)
            {
            print DONE_OUT "C02F,$_";
            }
#L 09/15/2007 - 05:13:04: -------- Mapchange to awp_war --------
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): -------- Mapchange to (.*) --------$/)
            {
            print DONE_OUT "C02G,$_";
            }
#L 06/19/2007 - 21:26:40: Server say "DRB I need your steam id to fix the ban"
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): Server say \"(.*)\"$/)
            {
            print DONE_OUT "C03G,$_";
            }
#L 09/15/2007 - 04:48:35: FoCA|quibeep has left; de_dust is no longer nominated
elsif ($LOGLINE = m/^L (\d\d)\/(\d\d)\/(\d\d\d\d) - (\d\d:\d\d:\d\d): (.*) has left; (.*) is no longer nominated$/)
            {
            print DONE_OUT "C03H,$_";
            }

################
################

        else
            {
            print TODO_OUT "$_";
            #print "$_";                        
            }
            
        }    
        close (LOGFILE_IN);
        close ($FILE);        
    } #Close of log file
        

     #End of log files
    
    
##################################################
################### Main Loop End ################
##################################################


sub printmissing
    {
    #Alternate the comment if you really want to see the area that sent the 
    #line, otherwise just output the $_
    
    #print MISSING "$printout\n$_\n";
    print "Missing $_\n";
    }