Live 6 humans online 1 active servers Peak online today 16 Record 102

SoF2 Server Logs: games.log, Hit Logging and Rotation

What a Soldier of Fortune II server logs to games.log, the g_log settings, hit logging, keeping logs small with rotation, and privacy.

Updated 3 min read Servers and hosting

On this page

A Soldier of Fortune II server writes its game events to games.log, set by g_log: who joined and left, kills, chat and map changes. g_logSync 1 writes each line straight away instead of in batches, and g_logHits 1 adds a line for every bullet hit, which makes the file very large. Logs are useful for dealing with abuse and building your own statistics. SOF2MP.com doesn’t need them to list your server.

The log settings

SoF2 server log settings
CVARWhat it doesDefaultRecommended
g_logFilename for the game event log.games.log—
g_logSyncForces synchronous (immediate) writes to the game log file.0—
g_logHitsLogs individual bullet hit events to the game log.0—
logfilenameFilename for the console output log.qconsole.log—

games.log: the game log

The game log records what happens in matches, line by line, with a timestamp. It’s the file to check when a player reports abuse, or when you want to know who was on the server at a certain time.

  • Turn it on by setting a file name: seta g_log "games.log". Set it to an empty value to turn logging off.
  • It’s written in the folder of the mod the server runs, for example rocmod/games.log, or base with no mod.
  • Use g_logSync 1 if a script or tool reads the log while the server is running, so it sees events straight away.

Hit logging

g_logHits 1 writes a line for every hit, which turns a few megabytes a day into far more on a busy server. It’s useful for a short time, for example to look into suspected cheating or to study weapon balance, but turn it off afterwards.

The console log

The server’s console output can also be saved to a file, named by logfilename, qconsole.log by default. It holds what you’d see in the server window: start-up messages and errors. When a server won’t start or a map won’t load, look for this file in the server’s folder, or run the server in a terminal and read the output directly.

Keep logs from growing forever

SoF2 adds to the same log file indefinitely. On a busy server it grows to a large size over months. Rotate it:

On Linux

Use logrotate. A file like this in /etc/logrotate.d/sof2 keeps four weeks of compressed logs:

/home/sof2/sof2/rocmod/games.log {
    weekly
    rotate 4
    compress
    missingok
    notifempty
    copytruncate
}

copytruncate matters: the server keeps the file open, so the log is copied and then emptied in place rather than moved. Change the path to where your log is.

On Windows

Stop the server at a quiet time, move games.log into an archive folder with the date in its name, and start the server again. A scheduled task can do this for you, alongside a regular restart.

Logs and privacy

Logs contain player names, chat and IP addresses. In the UK and EU that’s personal data, so:

  • Keep logs only as long as you need them. A few weeks is usually enough for dealing with abuse.
  • Don’t publish raw logs. Share only what’s needed with your admins.
  • Say in your server rules or on your website that the server keeps logs and why.

Logs and SOF2MP.com stats

SOF2MP.com builds player and server statistics by querying each public server’s status every few minutes, the same way the in-game browser does. You don’t need to send us logs or install anything. How it works is explained in how we count SoF2 players, and how to get listed is in getting your server listed.

Frequently asked questions

Where is games.log on a SoF2 server?

In the folder of the mod the server runs, such as rocmod, or in base if it runs without a mod.

How do I turn off logging on a SoF2 server?

Set g_log to an empty value: seta g_log "".

What does g_logHits do?

It logs every bullet hit. It makes logs very large, so only turn it on for a short time.

Do I need to share my logs to appear on SOF2MP.com?

No. SOF2MP.com queries servers directly, so no logs are needed.

Was this guide helpful?

Written and kept up to date by the SOF2MP.com community. Live numbers on this page come from our own tracking of every public SoF2 server. Spotted something out of date? Tell us on Discord.