Killing Floor 2

Killing Floor 2

Not enough ratings
Fixing excessive workshop logging on the KF2 server
By ℍ𝕚𝕔𝕜𝔻𝕖𝕒𝕕_ and 2 collaborators
A few ways to fix the excessive logging on the KF2 Server when it is subscribed to workshop items.

   
Award
Favorite
Favorited
Unfavorite
About the problem
UPDATE: This bug seems to have been fixed with the 27 March 2018 update 1062:
  • Fixed a code bug with dedicated servers where logs were being generated that consumed a lot of CPU after a period of time

The problem is that when your KF2 server is subscribed to workshop items, it logs lines containing all the numbers of the items that it's subscribed to. So more items subscribed the bigger the problem. There is an example of one line of logging from a server on pastebin here[pastebin.com], that has more then 300 maps subscribed. By itself this may not seem to impressive, however this gets logged every second 24/7 causing noticeable I/O and CPU usage (after a while) and resulting in rather large (not to mention useless) logfiles.
File sizes after only a few hours of running on the forementioned server. After a few days this can (and will) seriously degrade the server's performance, not to mention waste its valueable resources considerably.

Below there are several workarounds described on how to deal with this issue, some more useful or practical then others, pick whichever suits you best.
Running the steam client before starting the server
Option one is to run the steam client first, this will prevent the logging (and possibly workshop items getting updated) on the server.
Denying permission on the logfiles
Option two is to change the permissions on the content_log.txt and workshop_log.txt logfiles in the \kf2server\Binaries\Win64\logs directory, so the user running the server is not allowed to write and append to or delete the logfiles. Not sure all three options are needed, please do let us know if you try variations and how that worked out. This is likely the most practical workaround by far.
  1. right click the filename in windows explorer.
  2. select Properties from the menu and click it
  3. go to the Security tab of the window that pops up
  4. click the Advanced button
  5. click the Change Permission... button of the window that opened
  6. click the Add... button of the window that popped up
  7. in the new window that opened type the username that runs the server and click the OK button
  8. click the box in the Deny column for the Create files / write data, Create folders / append data and Delete lines.
  9. keep clicking the OK buttons untill all the new little windows are closed again.
Hexedeting steamclient64.dll
Option three is to do a bit of hexeditting.

This came out of the attempt to create symlinks (with the mklink command) instead of the logfiles to the "NUL", which is a reserved name in windows to make output not get written to disk. That worked somewhat except for the file actually getting created and written to, as windows apparantly doesn't implement that feature properly but the special status did prevent it form being opened in notepad or deleted with explorer. [insert rolling eyes smiley here]

Then we tried to change the names of the logfiles to NUL by hexediting the steamclient64.dll, which also worked but had the same effect as the symlink attempt.

What did work was to change the filenames to invalid names, this still creates the files (with only the first part of the name) but doesn't write anything to them. Step 1 is optional but recommended.
  1. make a backup copy of ...\kf2server\Binaries\Win64\steamclient64.dll first
  2. open ...\kf2server\Binaries\Win64\steamclient64.dll with your favorite hexeditor
  3. search for the text content_log
  4. replace the underscore '_' with a colon ':'
  5. do the same for workshop_log
Removing steamclient64.dll
Option four is to remove ...\kf2server\Binaries\Win64steamclient64.dll altogether, the best way to do so would be to rename it to something else like steamclient64.dll.orig so that it's easy to undo. This method is just about guaranteed to break updating the workshop items on your server.
KF2 server running on linux
On linux it should be very easy to fix, simply create a symbolic link to the null device.
  1. cd <wherever these logfiles are>
  2. ln -sf content_log.txt /dev/null
  3. ln -sf workshop_log.txt /dev/null
Suppressing regular workshop logging
Additionally, you can add Suppress=NetComeGo and Suppress=Log in the [Core.System] section of PCServer-KFEngine.ini to suppress logs with the tags 'NetComeGo' and 'Log' in the regular server logfile (...\kf2server\KFGame\Logs\Launch.log).

NetComeGo tends to spam the log with update checking for each workshop item, and Log (which is a very generic tag) is used for checking the state of each workshop item when loading the server (which appears as Log: UKFWorkshopSteamworks...). Adding suppression rules for logging is particularly useful for debugging when creating mods.

Thanks goes to Pharrahnox for pointing this out. Personally I (HickDead) surpress 'DevOnline' as well on my little test server just to keep the regular logs a bit more readable.
2 Comments
ℍ𝕚𝕔𝕜𝔻𝕖𝕒𝕕_  [author] 9 Jan, 2018 @ 6:52am 
Thanks Pharrahnox, I've added that info to the guide as well.
Pharrahnox 9 Jan, 2018 @ 5:27am 
Additionally, add Suppress=NetComeGo and Suppress=Log in the [Core.System] section of PCServer-KFEngine.ini to suppress logs with the tags 'NetComeGo' and 'Log'. NetComeGo tends to spam the log with update checking for each workshop item, and Log (which is a very generic tag) is used for checking the state of each workshop item when loading the server (which appears as Log: UKFWorkshopSteamworks...). Adding suppression rules for logging is particularly useful for debugging when creating mods.