Skip to content

vitorvasc/logparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logparser

About the application

Logparser is a simple application built using Go that reads a log file generated by Quake 3 Arena Server and extracts useful informations for each match.

How to run

To run the application, you need to have Go version >= 1.21 installed on your machine. After that, you can run the following command:

go run cmd/main.go

The application will be executed on your console, using a simple CLI (command line interface) showing a simple menu with the following options:

1. Process log file and load matches
2. Generate report by game number
3. Generate report by game number, including deaths by cause
4. Generate complete report (all games, including deaths by cause)
9. Exit 

Option 1: Process log file and load matches

When you select the first option, the application will search and load the log file stored on resources/qgames.log. This path is defined by the const LogFileLocation on the file cmd/main.go.

Log sample

The log file is a simple text file and the following format represents a match:

0:00 InitGame: \sv_floodProtect\1\sv_maxPing\0\sv_minPing\0\sv_maxRate\10000\sv_minRate\0\sv_hostname\Code Miner Server\g_gametype\0\sv_privateClients\2\sv_maxclients\16\sv_allowDownload\0\dmflags\0\fraglimit\20\timelimit\15\g_maxGameClients\0\capturelimit\8\version\ioq3 1.36 linux-x86_64 Apr 12 2009\protocol\68\mapname\q3dm17\gamename\baseq3\g_needpass\0
  0:25 ClientConnect: 2
  0:25 ClientUserinfoChanged: 2 n\Dono da Bola\t\0\model\sarge/krusade\hmodel\sarge/krusade\g_redteam\\g_blueteam\\c1\5\c2\5\hc\95\w\0\l\0\tt\0\tl\0
  0:27 ClientUserinfoChanged: 2 n\Mocinha\t\0\model\sarge\hmodel\sarge\g_redteam\\g_blueteam\\c1\4\c2\5\hc\95\w\0\l\0\tt\0\tl\0
  0:27 ClientBegin: 2
  0:29 Item: 2 weapon_rocketlauncher
  0:35 Item: 2 item_armor_shard
  0:35 Item: 2 item_armor_shard
  0:35 Item: 2 item_armor_shard
  0:35 Item: 2 item_armor_combat
  0:38 Item: 2 item_armor_shard
  0:38 Item: 2 item_armor_shard
  0:38 Item: 2 item_armor_shard
  0:55 Item: 2 item_health_large
  0:56 Item: 2 weapon_rocketlauncher
  0:57 Item: 2 ammo_rockets
  0:59 ClientConnect: 3
  0:59 ClientUserinfoChanged: 3 n\Isgalamido\t\0\model\xian/default\hmodel\xian/default\g_redteam\\g_blueteam\\c1\4\c2\5\hc\100\w\0\l\0\tt\0\tl\0
  1:01 ClientUserinfoChanged: 3 n\Isgalamido\t\0\model\uriel/zael\hmodel\uriel/zael\g_redteam\\g_blueteam\\c1\5\c2\5\hc\100\w\0\l\0\tt\0\tl\0
  1:01 ClientBegin: 3
  1:02 Item: 3 weapon_rocketlauncher
  1:04 Item: 2 item_armor_shard
  1:04 Item: 2 item_armor_shard
  1:04 Item: 2 item_armor_shard
  1:06 ClientConnect: 4
  1:06 ClientUserinfoChanged: 4 n\Zeh\t\0\model\sarge/default\hmodel\sarge/default\g_redteam\\g_blueteam\\c1\5\c2\5\hc\100\w\0\l\0\tt\0\tl\0
  1:08 Kill: 3 2 6: Isgalamido killed Mocinha by MOD_ROCKET
  1:08 ClientUserinfoChanged: 4 n\Zeh\t\0\model\sarge/default\hmodel\sarge/default\g_redteam\\g_blueteam\\c1\1\c2\5\hc\100\w\0\l\0\tt\0\tl\0
  1:08 ClientBegin: 4
  1:10 Item: 3 item_armor_shard
  1:10 Item: 3 item_armor_shard
  1:10 Item: 3 item_armor_shard
  1:10 Item: 3 item_armor_combat
  1:11 Item: 4 weapon_shotgun
  1:11 Item: 4 ammo_shells
  1:16 Item: 4 item_health_large
  1:18 Item: 4 weapon_rocketlauncher
  1:18 Item: 4 ammo_rockets
  1:26 Kill: 1022 4 22: <world> killed Zeh by MOD_TRIGGER_HURT
  1:26 ClientUserinfoChanged: 2 n\Dono da Bola\t\0\model\sarge\hmodel\sarge\g_redteam\\g_blueteam\\c1\4\c2\5\hc\95\w\0\l\0\tt\0\tl\0
  1:26 Item: 3 weapon_railgun
  1:29 Item: 2 weapon_rocketlauncher
  1:29 Item: 3 weapon_railgun
  1:32 Item: 3 weapon_railgun
  1:32 Kill: 1022 4 22: <world> killed Zeh by MOD_TRIGGER_HURT
  1:35 Item: 2 item_armor_shard
  1:35 Item: 2 item_armor_shard
  1:35 Item: 2 item_armor_shard
  1:35 Item: 3 weapon_railgun
  1:38 Item: 2 item_health_large
  1:38 Item: 3 weapon_railgun
  1:41 Kill: 1022 2 19: <world> killed Dono da Bola by MOD_FALLING
  1:41 Item: 3 weapon_railgun
  1:43 Item: 2 ammo_rockets
  1:44 Item: 2 weapon_rocketlauncher
  1:46 Item: 2 item_armor_shard
  1:47 Item: 2 item_armor_shard
  1:47 Item: 2 item_armor_shard
  1:47 ShutdownGame:

Option 2: Generate report by game number

When you select the second option, the application will ask for the game number you want to generate the report. After that, it will show the following information:

{
  "game_9": {
    "total_kills": 67,
    "players": [
      "Oootsimo",
      "Dono da Bola",
      "Zeh",
      "Chessus",
      "Mal",
      "Assasinu Credi"
    ],
    "kills": {
      "Assasinu Credi": 8,
      "Chessus": 11,
      "Dono da Bola": 2,
      "Mal": 6,
      "Oootsimo": 8,
      "Zeh": 15
    }
  }
}

Option 3: Generate report by game number, including deaths by cause

This type of report generates the details for the chosen match number. The result will be similar to the previous option, but with the additional information for deaths by cause. The result will be similar to the following example:

{
  "game_9": {
    "total_kills": 67,
    "players": [
      "Oootsimo",
      "Dono da Bola",
      "Zeh",
      "Chessus",
      "Mal",
      "Assasinu Credi"
    ],
    "kills": {
      "Assasinu Credi": 8,
      "Chessus": 11,
      "Dono da Bola": 2,
      "Mal": 6,
      "Oootsimo": 8,
      "Zeh": 15
    },
    "kills_by_means": {
      "MOD_FALLING": 3,
      "MOD_MACHINEGUN": 3,
      "MOD_RAILGUN": 10,
      "MOD_ROCKET": 17,
      "MOD_ROCKET_SPLASH": 25,
      "MOD_SHOTGUN": 1,
      "MOD_TRIGGER_HURT": 8
    }
  }

Option 4: Generate complete report (all games, including deaths by cause)

This type of report generates the details for all matches. The result will be similar to the previous option, but containing the information for all matches. The result will be similar to the following example:

{
  "game_7": {
    "total_kills": 130,
    "players": [
      "Oootsimo",
      "Isgalamido",
      "Zeh",
      "Dono da Bola",
      "Mal",
      "Assasinu Credi",
      "Chessus"
    ],
    "kills": {
      "Assasinu Credi": 19,
      "Chessus": 0,
      "Dono da Bola": 12,
      "Isgalamido": 18,
      "Mal": 9,
      "Oootsimo": 24,
      "Zeh": 13
    },
    "kills_by_means": {
      "MOD_FALLING": 7,
      "MOD_MACHINEGUN": 9,
      "MOD_RAILGUN": 9,
      "MOD_ROCKET": 29,
      "MOD_ROCKET_SPLASH": 49,
      "MOD_SHOTGUN": 7,
      "MOD_TRIGGER_HURT": 20
    }
  },
  "game_8": {
    "total_kills": 89,
    "players": [
      "Oootsimo",
      "Isgalamido",
      "Zeh",
      "Dono da Bola",
      "Mal",
      "Assasinu Credi"
    ],
    "kills": {
      "Assasinu Credi": 11,
      "Dono da Bola": 3,
      "Isgalamido": 24,
      "Mal": 0,
      "Oootsimo": 16,
      "Zeh": 15
    },
    "kills_by_means": {
      "MOD_FALLING": 6,
      "MOD_MACHINEGUN": 4,
      "MOD_RAILGUN": 12,
      "MOD_ROCKET": 18,
      "MOD_ROCKET_SPLASH": 39,
      "MOD_SHOTGUN": 1,
      "MOD_TRIGGER_HURT": 9
    }
  },
  "game_9": {
    "total_kills": 67,
    "players": [
      "Oootsimo",
      "Dono da Bola",
      "Zeh",
      "Chessus",
      "Mal",
      "Assasinu Credi"
    ],
    "kills": {
      "Assasinu Credi": 8,
      "Chessus": 11,
      "Dono da Bola": 2,
      "Mal": 6,
      "Oootsimo": 8,
      "Zeh": 15
    },
    "kills_by_means": {
      "MOD_FALLING": 3,
      "MOD_MACHINEGUN": 3,
      "MOD_RAILGUN": 10,
      "MOD_ROCKET": 17,
      "MOD_ROCKET_SPLASH": 25,
      "MOD_SHOTGUN": 1,
      "MOD_TRIGGER_HURT": 8
    }
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages