Allow Configuring LogFormatType
Is your feature request related to a problem? Please describe
I would like to use structured logging with Palworld for use with Victorialogs.
Describe the solution you'd like
I would like the ability to config the LogFormatType server option using an environment variable like LOG_FORMAT_TYPE
Describe alternatives you've considered
- write a custom parser for unstructured logs
- find a way to pass custom options to the server config file
Additional context
Feature Report Checklist
- [x] I am willing to implement this feature
Is this what you want?
LogInfo() {
Log "$1" "$WhiteText" "INFO"
}
LogWarn() {
Log "$1" "$YellowBoldText" "WARN"
}
LogError() {
Log "$1" "$RedBoldText" "ERROR"
}
LogSuccess() {
Log "$1" "$GreenBoldText" "SUCCESS"
}
LogAction() {
Log "****$1****" "$CyanBoldText" "ACTION"
}
Log() {
local message="$1"
local color="$2"
local level="$3"
local timestamp="$(date +"%Y-%m-%d %H:%M:%S")"
case "${LOG_FORMAT_TYPE,,}" in
"json")
echo "{\"timestamp\":\"${timestamp}\",\"level\":\"${level}\",\"message\":\"${message//\"/\\\"}\"}";;
"logfmt")
echo "timestamp=\"${timestamp}\" level=\"${level}\" message=\"${message//\"/\\\"}\"";;
"plain")
echo -e "[${timestamp}] [${level^^}] ${color}${message}${RESET}";;
*)
printf "$color%s$RESET$LINE" "$message";;
esac
}
that is correct thanks for following up on the issue
This does not process the logs of the entire container, but only the logs of the script, but is that okay?
The steamcmd log and PalServer-Linux-Shipping log are output raw, is this okay?
thanks for implementing this feature, It looks like only REST log does not follow the structured logging setting is this expected? so far I have noticed this with logfmt and json outputs
palworld-server | time="2025-12-02T11:02:21%:z" level="ACTION" msg="****Starting Server****"
palworld-server | ./PalServer.sh -port=8211 -queryport=27015 -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS -NumberOfWorkerThreadsServer=4
palworld-server | The file already exists: /palworld/Pal/Binaries/Linux/steamclient.so
palworld-server | Shutdown handler: initalize.
palworld-server | [S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
palworld-server | Setting breakpad minidump AppID = 2394010
palworld-server | [S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
palworld-server | [S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
palworld-server | [S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
palworld-server | [S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
palworld-server | 5.1.1-0+++UE5+Release-5.1 1008 0
palworld-server | Disabling core dumps.
palworld-server | Game version is v0.6.9.82048
palworld-server | REST API started on port 8212
palworld-server | Running Palworld dedicated server on :8211
palworld-server | time="2025-12-02T11:02:26%:z" level="INFO" msg="Waiting for REST API(8212) port to open to show player logging..."
palworld-server | [2025-12-02 11:02:26] [LOG] REST accessed endpoint /v1/api/players OK
palworld-server | [2025-12-02 11:02:30] [LOG] REST accessed endpoint /v1/api/metrics OK
palworld-server | [2025-12-02 11:02:31] [LOG] REST accessed endpoint /v1/api/players OK (x2)
palworld-server | [2025-12-02 11:02:40] [LOG] REST accessed endpoint /v1/api/metrics OK
palworld-server | [2025-12-02 11:02:41] [LOG] REST accessed endpoint /v1/api/players OK (x2)
Thank you for your response.
So it's necessary after all. Understood.
time="2025-12-02T11:02:21%:z"
This is bug. I will fix %:z.
Also, we'll compact the JSON format to one line.