Bug#864572: openarena-server: consider to use StandardOutput=null in systemd service files
On Tue, 25 Jul 2017 at 23:50:24 +0200, Markus Koschany wrote: > Am 24.07.2017 um 10:11 schrieb Simon McVittie: > > We could maybe give the openarena-server wrapper script a > > --logfile=LOGFILE option which would "exec >${logfile} 2>&1" before > > running the actual server, and make the systemd units run with > > "--logfile=/var/games/openarena-server/%i.oa/server.log" or > > "--logfile=/var/log/openarena-server/%i/server.log" or something? > > But then we'd need to implement at least simple log rotation (otherwise > > whenever the server crashed, the log with crash details would > > immediately be overwritten by the log for the restarted server). > > Alright, if you don't like the /dev/null plan then this would be the > next best option, although I'm pretty sure most output will be a > duplicate of games.log. Yeah - the Quake III Arena engine's approach to logging doesn't seem to have been particularly well thought out, with a lot of messages only going to stdout, but no built-in way to silence the ones that also go to games.log. > I'm just thinking that implementing the wrapper > script option --logfile isn't really necessary because we can implement > logging entirely in the service file [...] > ExecStart=/bin/sh -c '/usr/games/openarena-server +set com_homepath > server.oa $DAEMON_OPTS +exec etc/openarena-server/server.cfg > > /var/log/openarena-server/server.log 2>&1' I think I'd prefer to put it in the wrapper script, since we already have one. S
Bug#864572: openarena-server: consider to use StandardOutput=null in systemd service files
Am 24.07.2017 um 10:11 schrieb Simon McVittie: > On Sat, 10 Jun 2017 at 22:38:27 +0200, Markus Koschany wrote: >> Currently all in-game messages including chat conversations are >> logged in systemd's journal > ... >> Of course the workaround is to write these ignore rules or to >> overwrite the default service files with a custom one which is placed >> in /etc/systemd/system. >> >> Normally the latter is a good advice but I think in this special case >> we could use the StandardOutput=null option and stop logging to >> /var/log/syslog at all. The OpenArena server already logs the same >> information to /var/games/openarena-server/server.oa/baseoa/games.log >> thus the information wouldn't be lost. > > Unfortunately, this isn't entirely true. Writing out games.log is part > of the game plugin (qagame*.so), so it only logs certain in-game > messages from src:openarena (chat, kills, item pickups, that sort of > thing). If we redirected the server's stdout and stderr to /dev/null, we > would be missing the messages printed by the ioquake3 engine (startup, > shutdown, warnings, errors) some of which are fairly important, and we'd > also miss anything printed by src:openarena using G_Printf() instead of > G_LogPrintf(). Hmm, I have been running an OpenArena server in "production" for the past five years and I have never noticed those "fairly important" messages. But I still receive start/stop/restart messages when I use systemctl start/stop/restart and I also see this one once in a while Jul 25 21:19:42 linuxiuvat systemd[1]: openarena-server.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Jul 25 21:19:42 linuxiuvat systemd[1]: openarena-server.service: Unit entered failed state. Jul 25 21:19:42 linuxiuvat systemd[1]: openarena-server.service: Failed with result 'exit-code'. Jul 25 21:19:42 linuxiuvat systemd[1]: openarena-server.service: Service hold-off time over, scheduling restart. which is probably still bug #664637. > We could maybe give the openarena-server wrapper script a > --logfile=LOGFILE option which would "exec >${logfile} 2>&1" before > running the actual server, and make the systemd units run with > "--logfile=/var/games/openarena-server/%i.oa/server.log" or > "--logfile=/var/log/openarena-server/%i/server.log" or something? > But then we'd need to implement at least simple log rotation (otherwise > whenever the server crashed, the log with crash details would > immediately be overwritten by the log for the restarted server). Alright, if you don't like the /dev/null plan then this would be the next best option, although I'm pretty sure most output will be a duplicate of games.log. I'm just thinking that implementing the wrapper script option --logfile isn't really necessary because we can implement logging entirely in the service file. (although it's a bit inconvenient but I don't know a better way) I have investigated this issue before because I wondered why there is no simple option to redirect STDOUT or STDERR to a log file. Apparently we are supposed to use the ExecStart option like this: ExecStart=/bin/sh -c '/usr/games/openarena-server +set com_homepath server.oa $DAEMON_OPTS +exec etc/openarena-server/server.cfg > /var/log/openarena-server/server.log 2>&1' And then just add the %i for template units. [1] Implementing logrotate should also be straightforward, at least it was for minetest-server. > Alternatively, maybe we could add a cvar to disable printing lines to > stdout if they are also printed to games.log? (At the moment it's > controlled by the 'dedicated' cvar.) That way each line would be > printed to either the Journal or games.log but never both. That sounds interesting as well. Though in this case we would have to patch the game which I would try to avoid unless upstream is happy to accept the patch. Markus [1] https://stackoverflow.com/questions/32968506/how-to-pipe-output-to-a-file-when-running-as-a-systemd-service signature.asc Description: OpenPGP digital signature
Bug#864572: openarena-server: consider to use StandardOutput=null in systemd service files
On Sat, 10 Jun 2017 at 22:38:27 +0200, Markus Koschany wrote: > Currently all in-game messages including chat conversations are > logged in systemd's journal ... > Of course the workaround is to write these ignore rules or to > overwrite the default service files with a custom one which is placed > in /etc/systemd/system. > > Normally the latter is a good advice but I think in this special case > we could use the StandardOutput=null option and stop logging to > /var/log/syslog at all. The OpenArena server already logs the same > information to /var/games/openarena-server/server.oa/baseoa/games.log > thus the information wouldn't be lost. Unfortunately, this isn't entirely true. Writing out games.log is part of the game plugin (qagame*.so), so it only logs certain in-game messages from src:openarena (chat, kills, item pickups, that sort of thing). If we redirected the server's stdout and stderr to /dev/null, we would be missing the messages printed by the ioquake3 engine (startup, shutdown, warnings, errors) some of which are fairly important, and we'd also miss anything printed by src:openarena using G_Printf() instead of G_LogPrintf(). We could maybe give the openarena-server wrapper script a --logfile=LOGFILE option which would "exec >${logfile} 2>&1" before running the actual server, and make the systemd units run with "--logfile=/var/games/openarena-server/%i.oa/server.log" or "--logfile=/var/log/openarena-server/%i/server.log" or something? But then we'd need to implement at least simple log rotation (otherwise whenever the server crashed, the log with crash details would immediately be overwritten by the log for the restarted server). Alternatively, maybe we could add a cvar to disable printing lines to stdout if they are also printed to games.log? (At the moment it's controlled by the 'dedicated' cvar.) That way each line would be printed to either the Journal or games.log but never both. S
Bug#864572: openarena-server: consider to use StandardOutput=null in systemd service files
Package: openarena-server Version: 0.8.8-17 Severity: normal Currently all in-game messages including chat conversations are logged in systemd's journal and forwarded to the rsyslog daemon which in turn writes everything to /var/log/syslog. This is quite noisy and quickly fills /var/log/syslog with several megabyte of data per day. If one uses tools like logcheck which investigates /var/log/syslog by default and sends hourly emails about suspicious log activity, this can be quite annoying due to the missing ignore rules. Of course the workaround is to write these ignore rules or to overwrite the default service files with a custom one which is placed in /etc/systemd/system. Normally the latter is a good advice but I think in this special case we could use the StandardOutput=null option and stop logging to /var/log/syslog at all. The OpenArena server already logs the same information to /var/games/openarena-server/server.oa/baseoa/games.log thus the information wouldn't be lost. Please consider to use StandardOutput=null in both service files. Markus -- System Information: Debian Release: 9.0 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: unable to detect Versions of packages openarena-server depends on: ii adduser 3.115 ii init-system-helpers 1.48 pn ioquake3-server ii libc6 2.24-11 pn openarena-081-maps pn openarena-081-misc pn openarena-081-players pn openarena-081-players-mature pn openarena-081-textures pn openarena-085-data pn openarena-088-data pn openarena-data openarena-server recommends no packages. Versions of packages openarena-server suggests: pn openarena-oacmp1