Bug#864572: openarena-server: consider to use StandardOutput=null in systemd service files
Markus Koschany
apo at debian.org
Tue Jul 25 21:50:24 UTC 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20170725/a21f3fc0/attachment.sig>
More information about the Pkg-games-devel
mailing list