splunk / docker-splunk

Splunk Docker GitHub Repository
459 stars 253 forks source link

"Conf" unsupported option with docker compose #173

Closed davjr96 closed 5 years ago

davjr96 commented 5 years ago

I'm trying to set some variables in the web.conf file using the "create custom configs" documentation as provided here. https://splunk.github.io/docker-splunk/ADVANCED.html#create-custom-configs

I'm getting the error ERROR: The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services.splunk-container: 'conf'

My docker-compose is

version: "3" services: splunk-container: image: splunk/splunk:latest container_name: "splunk-container" restart: always environment:

As far as I can tell my syntax is correct based on the example. Am I following the example incorrectly or is there another way to do this?

Thanks!

nwang92 commented 5 years ago

I think you're confusing some of the logic of default.yml with the docker-compose.yml (there's not enough yaml out there yet :P)

What you'd probably want is something like:

# docker-compose.yml
version: "3.6"
services:
  splunk-container:
    image: splunk/splunk:latest
    container_name: splunk-container
    restart: always
    environment:
      - SPLUNK_START_ARGS=--accept-license
      - SPLUNK_PASSWORD=helloworld
    ports:
      - 8000
    volumes:
      - ./default.yml:/tmp/defaults/default.yml

Then a separate default.yml to control your Splunk settings:

# default.yml
splunk:
  conf:
    web:
      directory: /opt/splunk/etc/system/local
      content:
        settings:
          root_endpoint: /splunk
davjr96 commented 5 years ago

Ah you are right, Thanks! Mistake on my part. I'm now getting this on startup but I am sure its something to do with my config.

splunk-container | included: /opt/ansible/roles/splunk_common/tasks/set_config_file.yml for localhost => (item={'key': u'web', 'value': {u'directory': u'/opt/splunk/etc/system/local', u'content': {u'settings': {u'root_endpoint': u'/splunk'}}}}) splunk-container | Friday 12 April 2019 18:26:20 +0000 (0:00:00.098) 0:00:08.804 ** splunk-container | splunk-container | TASK [splunk_common : Create web.conf if not existing] * splunk-container | ok: [localhost] splunk-container | Friday 12 April 2019 18:26:20 +0000 (0:00:00.464) 0:00:09.269 ** splunk-container | included: /opt/ansible/roles/splunk_common/tasks/set_config_stanza.yml for localhost splunk-container | included: /opt/ansible/roles/splunk_common/tasks/set_config_stanza.yml for localhost splunk-container | Friday 12 April 2019 18:26:20 +0000 (0:00:00.125) 0:00:09.394 ** splunk-container | splunk-container | TASK [splunk_common : Set options in directory] **** splunk-container | fatal: [localhost]: FAILED! => {"msg": "with_dict expects a dict"} splunk-container | to retry, use: --limit @/opt/container_artifact/ansible-retry/site.retry splunk-container | splunk-container | PLAY RECAP ***** splunk-container | localhost : ok=24 changed=2 unreachable=0 failed=1

nwang92 commented 5 years ago

Hmm you may want to do a docker pull splunk/splunk just to make sure this is indeed the latest version. I believe the custom conf addition was added in versions >= 7.2.4, but I'd need to double-check. In any case, I'm going to close this issue, but if you continue to see problems please feel free to reach out!

sutcocuk commented 4 years ago

I have the same issue, did you make separate files and then compose them together or 1 by 1. Could you maybe explain it?