Posts: 2
Threads: 1
Joined: Feb 2021
Reputation:
0
I've enabled the -condebug and I'm looking to rename my console.log daily for each reset to keep a history of logs. I know I am able to set log srcds console to a file using something like
-consolelog console-$(date +%F_%H-%M-%S).log
Is it possible to do this with the server console -condebug?
Posts: 2
Threads: 1
Joined: Feb 2021
Reputation:
0
02-02-2021, 03:48 PM
(This post was last modified: 02-02-2021, 03:52 PM by cdymlr.)
I figured it out for anyone interested. The solution is to add the following line to srcds_run inside the run() [line 333] function.
mv /home/container/garrysmod/console.log /home/container/garrysmod/consolelogs/console-$(date +%F_%H-%M-%S).log
this moves the file "console.log" to a folder called "consolelogs" and renames it to the date and time it was generated. Before a new console.log is generated each time the server boots up, the previous log will be moved. This is good if your server resets, crashes, or completely explodes you will still have logs stored.
You will need to create the folder consolelogs inside your server's garrysmod folder. The logs will not be saved if the folder is not there.
You must set -condebug in startup to generate the console.log file.