Merge branch 'bugfix/KASM-5638_dont_exit_on_log_failure' into 'develop'

KASM-5638 Log messages may when attaching to docker networks. Dont exit

Closes KASM-5638

See merge request kasm-technologies/internal/workspaces-core-images!188
This commit is contained in:
Matthew McClaskey 2024-02-29 15:01:13 +00:00
commit c3c27140c8

View File

@ -10,7 +10,9 @@ log () {
INGEST_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "${INGEST_DATE} ${LOG_LEVEL} (${APP_NAME}): $1"
if [ ! -z "${KASM_API_JWT}" ] && [ ! -z "${KASM_API_HOST}" ] && [ ! -z "${KASM_API_PORT}" ]; then
set +e
http_proxy="" https_proxy="" curl https://${KASM_API_HOST}:${KASM_API_PORT}/api/kasm_session_log?token=${KASM_API_JWT} --max-time 1 -X POST -H 'Content-Type: application/json' -d '[{ "host": "'"${KASM_ID}"'", "application": "Session", "ingest_date": "'"${INGEST_DATE}"'", "message": "'"$1"'", "levelname": "'"${LOG_LEVEL}"'", "process": "'"${APP_NAME}"'", "kasm_user_name": "'"${KASM_USER_NAME}"'", "kasm_id": "'"${KASM_ID}"'" }]' -k -s
set -e
fi
fi
}