Giter VIP home page Giter VIP logo

svenstats's Introduction

svenstats.pl

Log parser for Sven Co-op dedicated servers (SvenDS) logs, to gather player statistics (name, score, deaths, country, etc.).

Notes

  • Assumes default SvenDS log settings (sv_log_daily 1, sv_log_onefile 0)
  • sv_log_player_frequency should be consistent for every log file to calculate playtime from the 'datapoints' value
  • Score differences achived by players before a map ends may be lost for up to a maximum of the sv_log_player_frequency value (seconds). This is due to the nature of how the logging works and thus the gathered stats are not 100% accurate, but still good enough :)
  • 'joins' are not acual joins, merely a hack to get a better session id ('idx')

Requirements

  • SvenDS log files
  • Perl >=5.16
    • MaxMind::DB::Reader (and GeoLite2-City.mmdb)
    • MaxMind::DB::Reader::XS (optional but much faster, requires libmaxminddb)
    • DBI
    • DBD::SQLite
    • File::Slurp
    • File::Basename
  • SQLite 3
  • xz-utils

Get started

  1. sqlite3 scstats.db < schema.sqlite
  2. Configure $db and $geo in svenstats.pl
  3. Optional: Feed it once with all existing (closed) logs (so not the one svends currently logging to!) for i in /path/to/logs/excluding/the/current/one/*.log ; do svenstats.pl $i ; done - Be sure to feed them in the correct order, from oldest to newest (* glob in bash should take care)
  4. Add a daily cronjob which feeds yesterdays closed log to svenstats.pl (example file: svenstats_cronjob.bash)
  5. Do cool stuff with the gathered data

svenstats_oneshot.pl

For posting daily statistics to Discord via webhook. Same principle as svenstats.pl but without a database and thus only for one log file at a time.

Requirements

  • SvenDS log files
  • Perl >=5.20
    • MaxMind::DB::Reader (and GeoLite2-City.mmdb)
    • MaxMind::DB::Reader::XS (optional but much faster, requires libmaxminddb)
    • File::Slurp
    • File::Basename
    • LWP::UserAgent
    • Encode::Simple
    • JSON::MaybeXS
    • JSON::XS (optional)

Get started

  1. Configure the Discord webhook URL: $url in svenstats_oneshot.pl
  2. Optionally set $steam to 1 and set $steamkey to your Steam API key if you want to use the Steam API (adds links to the players Steam Community profile)
  3. Add a daily cronjob which feeds yesterdays closed log to svenstats_oneshot.pl (example file: svenstats_cronjob.bash)

hldschat.pl

Outputs the in-game chat logs in simple HTML format. Without a database and thus only for one log file at a time.

Requirements

  • HLDS log files
  • Perl >=5.16
    • HTML::Entities

svenstats's People

Contributors

incognico avatar r4to0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

r4to0

svenstats's Issues

Slow as fuck

Yep, it's slow as fuck. Especially when initially creating the DB with a load worth of existing logs.

Multiple server support with one database

Hi mate,
thank you for your great work.

Would it be possible to store multiple servers in one database so that all requests for front-end output can be made to a single database?

Many Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.