gpt4 book ai didi

linux - Splunk错误: "Could not look up HOME variable"

转载 作者:太空宇宙 更新时间:2023-11-04 05:59:17 25 4
gpt4 key购买 nike

请帮助我理解这个 shell 脚本的作用:

# main
for HOST in ${HOSTS}
do
URI=http://${HOST}:80
count=99
result=`/opt/splunk/bin/splunk search "index=${INDEX} sourcetype=${SOURCETYPE} SPLUNK_HEALTH_CHECK |stats count" -earliest_time ${EARLIEST} -latest_time ${LATEST} -uri ${URI} -auth ${USER}:${PASS} -preview F -output csv -timeout ${TIMEOUT} 2>&1 |grep -v count |tr -d '\n' |sed 's/"//g'`
if expr $result : '[0-9]*' > /dev/null 2>&1; then

count=$result
result="OK"
fi
date +"%Y-%m-%d %T sh=${HOST} status=\"${result}\" delay_status=$count"
done

从 splunk 调用此脚本时,出现以下错误:

status="Could not look up HOME variable. Auth tokens cannot be cached.10" delay_status=99

最佳答案

无法查找 HOME 变量。无法缓存身份验证 token

当尝试以 root 用户身份运行 Splunk 或权限设置不正确时,通常会出现此错误。在您的情况下,您将 USER 和 PASS 传递到脚本中,但 bash 无法正确扩展这些值(请参阅 https://answers.splunk.com/answers/446944/getting-error-could-not-look-up-home-variable-auth.html )。

关于linux - Splunk错误: "Could not look up HOME variable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58618771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com