diff --git a/src/common/scripts/kasm_hook_scripts/kasm_pre_shutdown_user.sh b/src/common/scripts/kasm_hook_scripts/kasm_pre_shutdown_user.sh index 9502a3b..b905461 100644 --- a/src/common/scripts/kasm_hook_scripts/kasm_pre_shutdown_user.sh +++ b/src/common/scripts/kasm_hook_scripts/kasm_pre_shutdown_user.sh @@ -7,7 +7,9 @@ log () { LOG_LEVEL="${2:-DEBUG}" INGEST_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") echo "${INGEST_DATE} ${LOG_LEVEL} (${APP_NAME}): $1" - 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 + if [ ! -z "${KASM_API_JWT}" ] && [ ! -z "${KASM_API_HOST}" ] && [ ! -z "${KASM_API_PORT}" ]; then + 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 + fi fi } diff --git a/src/common/startup_scripts/vnc_startup.sh b/src/common/startup_scripts/vnc_startup.sh index b2ebf7e..b5f24ab 100755 --- a/src/common/startup_scripts/vnc_startup.sh +++ b/src/common/startup_scripts/vnc_startup.sh @@ -9,8 +9,10 @@ log () { LOG_LEVEL="${2:-DEBUG}" INGEST_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") echo "${INGEST_DATE} ${LOG_LEVEL} (${APP_NAME}): $1" - 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 - fi + if [ ! -z "${KASM_API_JWT}" ] && [ ! -z "${KASM_API_HOST}" ] && [ ! -z "${KASM_API_PORT}" ]; then + 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 + fi + fi } no_proxy="localhost,127.0.0.1"