npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cs2-log-parser

v1.0.3

Published

Parses CS2 logs into JavaScript objects.

Downloads

79

Readme

cs2-log-parser

A simple 0-dependency library that parses logs from a CS2 server into JavaScript objects, originally based on this fork by BLAST (available here), and the original library made by negezor (available here). These libraries however have not been updated in a while, which is the reason for making this one, which has been cleaned up & updated to the latest CS2 logging formats, with some new log parsers added.

For a list of the logs this library supports look inside the tests directory.

Install

npm i cs2-log-parser

Usage

HTTP

CS2 supports sending logs over HTTP POST requests by giving it an address using logaddress_add_http.
Here is a simple example using tinyhttp and milliparsec on how we can handle these on our server:

import { App } from "@tinyhttp/app";
import { text } from "milliparsec";
import { StatusCodes } from "http-status-codes";
import parse from "cs2-log-parser";

const app = new App();

app.post("/cs2_logs", text(), (req, res) => {

	const logLines = req.body.split("\n");

	for (const logLine of logLines) {

		const event = parse(logLine, { format: "http" });

		if (event === null) {
			continue;
		}

		console.log(event);
		
	}

	res.sendStatus(StatusCodes.OK);

});

app.listen(3000);

Log file

CS2 can write logs to a text file by setting sv_logfile 1, saved in a directory specified by sv_logsdir (defaults to logs inside the game/csgo folder).
Here is a simple example on how we can read these using Node's built-in fs & path modules:

import fs from "fs";
import path from "path";
import parse from "cs2-log-parser";

const logFilePath = path.join(
  "C:",
  "Program Files (x86)",
  "Steam",
  "steamapps",
  "common",
  "Counter-Strike Global Offensive",
  "game",
  "csgo",
  "logs",
  "2025_10_08_214757.log"
);

const logFileData = fs.readFileSync(logFilePath, "utf-8");

const logLines = logFileData.split("\n");

for (const logLine of logLines) {

    // Log file lines begin with "L" & contain whitespace, we clean them up here
    const cleanLogLine = logLine.slice(1).trim();

    const event = parse(cleanLogLine, { format: "file" });

    if (!event) {
        continue;
    }

    console.log(event);
    
}

Note

Some logs require additional ConVars to be set on the server in order to get logged, specifically:

  • attacked needs mp_logdetail set to either 1 (to log enemy attacks), 2 (to log team attacks) or 3 (to log both).
  • picked_up needs mp_logdetail_items set to true (or 1).