HLstatsZ — Real-time stats daemon for GoldSrc, Source, and Source 2 (CS2)
HLstatsZ is the only active HLstatsX fork with native Counter-Strike 2 support via Valve’s HTTP log transport. It stays fully backward-compatible with all UDP-based Source and GoldSrc games.- Hardened code and config loading — Consistent use of use strict ensures no hidden bugs; database settings are applied through symbolic references rather than eval; raw log bytes are always decoded to prevent any compromised DB value from injecting code into the running daemon.
- Dual-protocol listener on one port — Mojo::IOLoop watches a raw UDP socket and a Mojo::Server:
aemon (HTTP) simultaneously. GoldSrc/Source logs arrive over UDP; CS2 logs arrive over HTTP. Both feed the same parser. - Non-blocking by design — UDP and HTTP each have their own queue (@UDPQ / @HTTPQ) drained via Mojo::IOLoop->next_tick(). A burst of CS2 traffic never starves UDP servers or vice versa, and neither blocks the main loop.
- Periodic tasks stay low-priority — cleanup, stats snapshots, and DB flushes run on Mojo::IOLoop->recurring() timers, always yielding to incoming log traffic.
- Buffered batch INSERTs — events queue up and flush in bulk (configurable size, default 50), reducing InnoDB write pressure at high log rates.
- CS2 userid quirk handling — CS2 initially assigns every connecting player userid=0, then reassigns the real userid. The daemon tracks and migrates player keys transparently.
- Automatic socket health-check — detects stale connections and reconnects without restarting.
- Built-in daily cronjob — awards and bans run automatically; no external cron needed.
- MariaDB or MySQL — InnoDB-optimised queries, fastest collation (schema ≥ 84).
- GeoIP2 — optional binary GeoIP2-City lookup for player location.
- Cross-platform — Linux and Windows (Strawberry Perl).
Perl modules:
- Mojolicious
- GeoIP2 + GeoIP2:
atabase::Reader (optional) - DBD::MariaDB (optional, or DBD::mysql)
<span># Linux</span><br>curl -L https://cpanmin.us | perl - -M https://cpan.metacpan.org -n Mojolicious<br><br><span># Windows (Strawberry Perl)</span><br>cpan install Mojolicious<br>
Windows Perl: Strawberry Perl 5.38.0.1 64-bit (must be compiled with MySQL support)
Use your existing db or import the schema:
mysql -u root -p hlstats < sql/install.sql<br>
allow inbound traffic on TCP 27500 and UDP 27500<br>
Edit hlstats.conf:
DBHost "localhost"<br>DBName "hlstats"<br>DBUsername "root"<br>DBPassword "yourpassword"<br>Port "27500"<br>
Built-in daily cronjob (optional):
PathPerl "/usr/bin/perl"<br>PathAwards "/usr/bin/hlstats/hlstats-awards.pl"<br>PathBans "/usr/bin/hlstats/Importbans/importbans.pl"<br>
GoldSrc (Half-Life 1)
Recommended plugin: hlstats_cs.amxx
rcon_password "PaSsWoRd"<br>log on<br>logaddress_delall<br>logaddress_add 64.74.97.164 27500<br>
Source (CS:GO, TF2, L4D2 …)
Recommended plugin: hlstatsx.smx
rcon_password "PaSsWoRd"<br>log on<br>logaddress_delall<br>logaddress_add "64.74.97.164:27500"<br>
Source 2 — Counter-Strike 2
Recommended plugin: HLstatsZ CS2 plugin or HLstatsZ Classics plugin
rcon_password "PaSsWoRd"<br>log on<br>logaddress_delall_http<br>logaddress_add_http "http://64.74.97.164:27500"<br>sv_visiblemaxplayers 32<br>
Add -usercon to your server launch options.
Optional secondary address for testing against a different daemon:
logaddress_add_http_delayed 0.0 "http://64.74.97.164:27501"<br>
<span># Linux</span><br>./run_hlstats<br><br><span># Windows</span><br>run-hlstats.ps1<br>
Any HLstats‑compatible frontend will run — but most legacy ones are outdated, unmaintained or poorly patched and look 15+ years old.
The good news is that fully modern, actively maintained frontends are available today — and they drop in with the same database structure you’re already using.
Recommended modern frontends
Both are modern, responsive, and drop‑in compatible.
And more are currently in development!
Where should I run HLstatsZ?
On the machine that hosts your SQL database — not on your game server.
Why don’t daily awards run?
Set PathPerl and PathAwards / PathBans in hlstats.conf. The built-in cronjob fires automatically once per day.
How do I ignore Warmup or End-of-Round?
In the Game Settings > Configure > entry set BonusRoundIgnore = 1.
Does it support multiple servers?
Yes. Add each server to the database; the daemon handles all of them in a single process.
The clever architecture allows for virtually unlimited servers from just one daemon!
Who’s using it?
HLstatsZ has already been widely adopted by many hosting companies, internet cafes, and various gaming communities around the world.
HLstats (Simon Garner)<br> └─ HLstatsX (Tobias Oetzel)<br> └─ ELstatsNEO (Malte Bayer)<br> └─ HLstatsX:CE (Nicholas Hastings)<br> └─ HLstatsZ (SnipeZilla) ← now you are stuck here<br>
Based on HLstatsX:CE 1.6.19
Maintained and modernized by SnipeZilla
Validation and help by ghost-
Licensed under the GNU General Public License v2 or later.