LinuxGSM
LinuxGSM copied to clipboard
[Bug]: rustserver-game.log is not getting rotated
User story
As a server owner, I want the log files to rotate, just like the console & script folders so that I can access previous logs and it doesnt get overwritten.
Game
Rust
Linux distro
Ubuntu 24.04
Command
command: start
Further information
On a fresh server install, there is only rustserver-game.log. Every time the server restarts, it just overwrites this file, and does not produce a rotating log.
Someone in LGSM support showed this line of code, which shows only unreal2 will rotate log files.
Relevant log output
None, it is just the rustserver-game.log being overwritten anytime. If you need more log output please let me know.
Steps to reproduce
Install Rust server Start server Stop Server Start server
There will always be only 1 rustserver-game.log file and it never rotates.
I updated the script manually to:
# Log rotation.
fn_script_log_info "Rotating log files"
if [ "${engine}" == "unreal2" ] && [ -f "${gamelog}" ]; then
mv "${gamelog}" "${gamelogdate}"
elif [ "${engine}" == "unity3d" ] && [ -f "${gamelog}" ]; then
mv "${gamelog}" "${gamelogdate}"
fi
if [ -f "${lgsmlog}" ]; then
mv "${lgsmlog}" "${lgsmlogdate}"
fi
if [ -f "${consolelog}" ]; then
mv "${consolelog}" "${consolelogdate}"
fi
and it works now as expected.