Log flusher
Background: srcds writes various messages to a log file. By default, some amount of logs are buffered in the process memory before being flushed to the log file. Depending on the amount of activity on your server and the logging options, a flush happens anywhere between every few seconds to every few hours. If the srcds process crashes or is stopped untidily, the logs that are buffered in memory are lost and not written to the disk.
This can be solved using the sv_logflush server variable, which is set to 0 by default. Setting it to 1 will cause the server to update the log file for every single log message. So if the process crashes no log lines are lost. However, this is I/O-intensive, especially if a machine runs several game servers.
What this plugin does: This plugin flushes the log file periodically every X seconds (600 by default, i.e. 10 minutes). That way, when the server crashes or is closed untidily, some logs are lost but not too much. Another use for this plugin is in conjunction with systems that parse the server log files, to ensure they feed on "fresh" log data that's no older than X seconds. For example, PsychoStats, which continuously updates player ranking statistics.
CVars:
logflush (default: 600). 0 = disable logflush plugin. Anything else is the number of seconds between log flushes.
Installation:
- Put the plugin in your addons/sourcemod/plugins directory
- The configuration file will be created when the plugin is first run under cfg/sourcemod/plugin.logflush.cfg