部署Splunk Docker映像无法登录

时间:2018-10-07 15:01:06

标签: docker splunk

正如我从repository README中学到的,我正在使用splunk/splunk docker image和以下命令来构建和运行:

docker build --network=$DOCKER_NETWORK -t my-splunk .

docker run \
    --name=my-splunk \
    --network=$DOCKER_NETWORK \
    -p 8000:8000 \
    -e SPLUNK_START_ARGS="--accept-license" \
    -e SPLUNK_PASSWORD="1234" \
    --restart unless-stopped \
    -d my-splunk

当我在localhost:8000上打开浏览器时,按预期获得了Splunk登录页面,但是在键入admin1234时出现了错误401:

  

不存在用户。请设置一个用户。

从容器中查看/opt/splunk/etc/system/local/user-seed.conf,内容看起来不错:

[user_info]
USERNAME = admin
PASSWORD = 1234

完整的docker日志:

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
Sunday 07 October 2018  17:39:17 +0300 (0:00:00.091)       0:00:00.091 ********
ok: [localhost]

TASK [include_role : splunk_upgrade] *******************************************
Sunday 07 October 2018  17:39:18 +0300 (0:00:01.821)       0:00:01.913 ********

TASK [include_role : {{ splunk.role }}] ****************************************
Sunday 07 October 2018  17:39:19 +0300 (0:00:00.031)       0:00:01.945 ********

TASK [splunk_common : Install Splunk] ******************************************
Sunday 07 October 2018  17:39:19 +0300 (0:00:00.075)       0:00:02.021 ********
changed: [localhost]

TASK [splunk_common : Install Splunk (Windows)] ********************************
Sunday 07 October 2018  17:39:47 +0300 (0:00:28.257)       0:00:30.278 ********

TASK [splunk_common : Generate user-seed.conf] *********************************
Sunday 07 October 2018  17:39:47 +0300 (0:00:00.041)       0:00:30.320 ********
changed: [localhost] => (item=USERNAME)
changed: [localhost] => (item=PASSWORD)

TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018  17:39:47 +0300 (0:00:00.377)       0:00:30.697 ********
included: /opt/ansible/roles/splunk_common/tasks/enable_s2s_port.yml for localhost

TASK [splunk_common : Enable the Splunk-to-Splunk port] ************************
Sunday 07 October 2018  17:39:47 +0300 (0:00:00.062)       0:00:30.759 ********
changed: [localhost]

TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018  17:39:50 +0300 (0:00:02.733)       0:00:33.492 ********
included: /opt/ansible/roles/splunk_common/tasks/start_splunk.yml for localhost

TASK [splunk_common : Start Splunk] ********************************************
Sunday 07 October 2018  17:39:50 +0300 (0:00:00.054)       0:00:33.547 ********
changed: [localhost]

TASK [splunk_common : include_tasks] *******************************************
Sunday 07 October 2018  17:39:57 +0300 (0:00:07.214)       0:00:40.761 ********
included: /opt/ansible/roles/splunk_common/tasks/add_splunk_license.yml for localhost

TASK [splunk_common : Download Splunk license] *********************************
Sunday 07 October 2018  17:39:57 +0300 (0:00:00.056)       0:00:40.818 ********

TASK [splunk_common : Set downloaded license location] *************************
Sunday 07 October 2018  17:39:57 +0300 (0:00:00.037)       0:00:40.855 ********

TASK [splunk_common : Set local license location] ******************************
Sunday 07 October 2018  17:39:57 +0300 (0:00:00.034)       0:00:40.889 ********
ok: [localhost]

TASK [splunk_common : Apply Splunk license] ************************************
Sunday 07 October 2018  17:39:58 +0300 (0:00:00.043)       0:00:40.933 ********
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["/opt/splunk/bin/splunk", "add", "licenses", "-auth", "admin:1234"], "delta": "0:00:01.050830", "end": "2018-10-07 17:39:59.189296", "msg": "non-zero return code", "rc": 4, "start": "2018-10-07 17:39:58.138466", "stderr": "", "stderr_lines": [], "stdout": "missing PATH-TO-LICENSE-FILE argument: ./splunk add license [PATH-TO-FILE] ", "stdout_lines": ["missing PATH-TO-LICENSE-FILE argument: ./splunk add license [PATH-TO-FILE] "]}
...ignoring

TASK [splunk_common : Set as license slave] ************************************
Sunday 07 October 2018  17:39:59 +0300 (0:00:01.213)       0:00:42.146 ********

TASK [include_role : splunk_search_head] ***************************************
Sunday 07 October 2018  17:39:59 +0300 (0:00:00.031)       0:00:42.178 ********

PLAY RECAP *********************************************************************
localhost                  : ok=10   changed=5    unreachable=0    failed=0

Sunday 07 October 2018  17:39:59 +0300 (0:00:00.048)       0:00:42.226 ********
===============================================================================
splunk_common : Install Splunk ----------------------------------------- 28.26s
splunk_common : Start Splunk -------------------------------------------- 7.21s
splunk_common : Enable the Splunk-to-Splunk port ------------------------ 2.73s
Gathering Facts --------------------------------------------------------- 1.82s
splunk_common : Apply Splunk license ------------------------------------ 1.21s
splunk_common : Generate user-seed.conf --------------------------------- 0.38s
include_role : {{ splunk.role }} ---------------------------------------- 0.08s
splunk_common : include_tasks ------------------------------------------- 0.06s
splunk_common : include_tasks ------------------------------------------- 0.06s
splunk_common : include_tasks ------------------------------------------- 0.05s
include_role : splunk_search_head --------------------------------------- 0.05s
splunk_common : Set local license location ------------------------------ 0.04s
splunk_common : Install Splunk (Windows) -------------------------------- 0.04s
splunk_common : Download Splunk license --------------------------------- 0.04s
splunk_common : Set downloaded license location ------------------------- 0.03s
include_role : splunk_upgrade ------------------------------------------- 0.03s
splunk_common : Set as license slave ------------------------------------ 0.03s
===============================================================================

Ansible playbook complete, will begin streaming var/log/splunk/splunkd_stderr.log

1 个答案:

答案 0 :(得分:1)

好吧,显然密码必须符合https://hub.docker.com/r/splunk/splunk/的某些默认要求:

  

对于基本的独立Splunk环境,运行以下命令:

     

$ docker run -d -p 8000:8000 -e'SPLUNK_START_ARGS =-accept-license'   -e'SPLUNK_PASSWORD ='splunk / splunk:latest注意:提供的密码必须符合默认的Splunk Enterprise   密码要求*

将密码从“ 1234”更改为“ 12345678910”后,登录可以正常工作(唯一重要的默认要求是密码长度至少应为8个字符)。

由于创建用户的失败已被忽略,并且由于仅在dockerhub中记录了此问题,而在github中没有记录,因此我将打开一个案例以通知他们。

相关问题