[GH-ISSUE #4497] [Bug]: logtimestamp will use the server's start timestamp for every log entry, rather than the time the line occurs at #2808

Open
opened 2026-02-27 03:05:34 +03:00 by kerem · 1 comment
Owner

Originally created by @Crimson-Decoded on GitHub (Feb 12, 2024).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/4497

User story

As a server administrator, I want accurate timestamps recorded in the console log files.

Game

Minecraft, Valheim

Linux distro

Ubuntu 22.04

Command

command: start

Further information

The logtimestamp setting appears to re-use the server start timestamp for every log entry, resulting in timestamps that are unreliable. This can most easily be confirmed by servers that already utilize time/datestamps in their log (like Valheim).

This may be a limitation of how tmux works.
Reviewing the code in command_start.sh

addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'"

<...>

        if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
                if [ "${logtimestamp}" == "on" ]; then
                        tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
                else
                        tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
                fi
        else

given that this is in command_start.sh, this will affect all gameservers.

logs provided show the timestamp added by lgsm, followed by the minecraft native console timestamp, as well as valheim console logs which display not just time, but date, showing a huge disparity between the two.

Relevant log output

Minecraft:
[2024-02-04 09:30:56] [11:04:07] [RCON Listener #2/INFO] [minecraft/GenericThread]: Thread RCON Client /127.0.0.1 started
[2024-02-04 09:30:56] [11:04:07] [Server thread/INFO] [minecraft/MinecraftServer]: [Rcon: Automatic saving is now enabled]
[2024-02-04 09:30:56] [11:04:07] [RCON Client /127.0.0.1 #23/INFO] [minecraft/RconClient]: Thread RCON Client /127.0.0.1 shutting down
[2024-02-04 09:30:56] [11:19:01] [RCON Listener #2/INFO] [minecraft/GenericThread]: Thread RCON Client /127.0.0.1 started
[2024-02-04 09:30:56] [11:19:01] [Server thread/INFO] [minecraft/MinecraftServer]: [Rcon: Automatic saving is now disabled]
[2024-02-04 09:30:56] [11:19:01] [RCON Client /127.0.0.1 #24/INFO] [minecraft/RconClient]: Thread RCON Client /127.0.0.1 shutting down


Valheim:
[2024-02-04 09:30:55] 02/12/2024 18:33:38: Sending message to save player profiles
[2024-02-04 09:30:55] 02/12/2024 18:33:38: PrepareSave: clone done in 30ms
[2024-02-04 09:30:55] 02/12/2024 18:33:38: PrepareSave: ZDOExtraData.PrepareSave done in 10 ms
[2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing starting
[2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing started
[2024-02-04 09:30:55] 02/12/2024 18:33:38: Saved 83716 ZDOs
[2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing finishing
[2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing finished
[2024-02-04 09:30:55] 02/12/2024 18:33:38: World saved ( 201.645ms )
[2024-02-04 09:30:55] 02/12/2024 18:41:42:  Connections 0 ZDOS:83716  sent:0 recv:0
[2024-02-04 09:30:55] 02/12/2024 18:48:38: Sending message to save player profiles
[2024-02-04 09:30:55] 02/12/2024 18:48:38: PrepareSave: clone done in 13ms
[2024-02-04 09:30:55] 02/12/2024 18:48:38: PrepareSave: ZDOExtraData.PrepareSave done in 10 ms
[2024-02-04 09:30:55] 02/12/2024 18:48:38: World save writing starting
[2024-02-04 09:30:55] 02/12/2024 18:48:38: World save writing started
[2024-02-04 09:30:55] 02/12/2024 18:48:39: Saved 83716 ZDOs
[2024-02-04 09:30:55] 02/12/2024 18:48:39: World save writing finishing
[2024-02-04 09:30:55] 02/12/2024 18:48:39: World save writing finished
[2024-02-04 09:30:55] 02/12/2024 18:48:39: World saved ( 212.881ms )

Steps to reproduce

  1. set logtimestamp="on" in lgsm/config-lgsm/gameserver/*.cfg
  2. start the gameserver
  3. review log/console/gameserver-console.log and see the same timestamp (server star time) for all console entries regardless of how long has passed.
Originally created by @Crimson-Decoded on GitHub (Feb 12, 2024). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/4497 ### User story As a server administrator, I want accurate timestamps recorded in the console log files. ### Game Minecraft, Valheim ### Linux distro Ubuntu 22.04 ### Command command: start ### Further information The logtimestamp setting appears to re-use the server start timestamp for every log entry, resulting in timestamps that are unreliable. This can most easily be confirmed by servers that already utilize time/datestamps in their log (like Valheim). This may be a limitation of how tmux works. Reviewing the code in command_start.sh ``` addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'" <...> if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then if [ "${logtimestamp}" == "on" ]; then tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'" else tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi else ``` given that this is in command_start.sh, this will affect all gameservers. logs provided show the timestamp added by lgsm, followed by the minecraft native console timestamp, as well as valheim console logs which display not just time, but date, showing a huge disparity between the two. ### Relevant log output ```shell Minecraft: [2024-02-04 09:30:56] [11:04:07] [RCON Listener #2/INFO] [minecraft/GenericThread]: Thread RCON Client /127.0.0.1 started [2024-02-04 09:30:56] [11:04:07] [Server thread/INFO] [minecraft/MinecraftServer]: [Rcon: Automatic saving is now enabled] [2024-02-04 09:30:56] [11:04:07] [RCON Client /127.0.0.1 #23/INFO] [minecraft/RconClient]: Thread RCON Client /127.0.0.1 shutting down [2024-02-04 09:30:56] [11:19:01] [RCON Listener #2/INFO] [minecraft/GenericThread]: Thread RCON Client /127.0.0.1 started [2024-02-04 09:30:56] [11:19:01] [Server thread/INFO] [minecraft/MinecraftServer]: [Rcon: Automatic saving is now disabled] [2024-02-04 09:30:56] [11:19:01] [RCON Client /127.0.0.1 #24/INFO] [minecraft/RconClient]: Thread RCON Client /127.0.0.1 shutting down Valheim: [2024-02-04 09:30:55] 02/12/2024 18:33:38: Sending message to save player profiles [2024-02-04 09:30:55] 02/12/2024 18:33:38: PrepareSave: clone done in 30ms [2024-02-04 09:30:55] 02/12/2024 18:33:38: PrepareSave: ZDOExtraData.PrepareSave done in 10 ms [2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing starting [2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing started [2024-02-04 09:30:55] 02/12/2024 18:33:38: Saved 83716 ZDOs [2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing finishing [2024-02-04 09:30:55] 02/12/2024 18:33:38: World save writing finished [2024-02-04 09:30:55] 02/12/2024 18:33:38: World saved ( 201.645ms ) [2024-02-04 09:30:55] 02/12/2024 18:41:42: Connections 0 ZDOS:83716 sent:0 recv:0 [2024-02-04 09:30:55] 02/12/2024 18:48:38: Sending message to save player profiles [2024-02-04 09:30:55] 02/12/2024 18:48:38: PrepareSave: clone done in 13ms [2024-02-04 09:30:55] 02/12/2024 18:48:38: PrepareSave: ZDOExtraData.PrepareSave done in 10 ms [2024-02-04 09:30:55] 02/12/2024 18:48:38: World save writing starting [2024-02-04 09:30:55] 02/12/2024 18:48:38: World save writing started [2024-02-04 09:30:55] 02/12/2024 18:48:39: Saved 83716 ZDOs [2024-02-04 09:30:55] 02/12/2024 18:48:39: World save writing finishing [2024-02-04 09:30:55] 02/12/2024 18:48:39: World save writing finished [2024-02-04 09:30:55] 02/12/2024 18:48:39: World saved ( 212.881ms ) ``` ### Steps to reproduce 1. set `logtimestamp="on"` in `lgsm/config-lgsm/gameserver/*.cfg` 2. start the gameserver 3. review `log/console/gameserver-console.log` and see the same timestamp (server star time) for all console entries regardless of how long has passed.
Author
Owner

@dgibbs64 commented on GitHub (Feb 27, 2024):

I just tested this and found the console log completely failing to work when enabled. There is something quite broken with this functionality is seems

<!-- gh-comment-id:1967580534 --> @dgibbs64 commented on GitHub (Feb 27, 2024): I just tested this and found the console log completely failing to work when enabled. There is something quite broken with this functionality is seems
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#2808
No description provided.