Хочу изменить готовый image sebp/elk.
Для этого, судя по мануалу, нужно Dockerfile следующего содержания:
FROM sebp/elk
WORKDIR ${LOGSTASH_HOME}
RUN gosu logstash bin/logstash-plugin install logstash-input-rss
Мне нужно добавить модуль в логстеш, и если я захожу в контейнер docker exec -it id_контейнера bin/bash и делаю там:
service logstash stop
cd /opt/logstash
bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966
service logstash start
то получаю то, что мне надо!
Как мне сделать готовый image, чтобы я делал контейнер уже с этой настройкой?
Пробую так:
FROM sebp/elk
WORKDIR ${LOGSTASH_HOME}
RUN gosu logstash bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966
или вот так:
WORKDIR ${LOGSTASH_HOME}
RUN cd /opt/logstash \
&& bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966
Результат этого один и тот же:
Step 3/3 : RUN cd /opt/logstash && bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966
---> Running in e68f0025019d
Sending Logstash's logs to /opt/logstash/logs which is now configured via log4j2.properties
[2018-05-25T14:09:22,940][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/opt/logstash/modules/fb_apache/configuration"}
[2018-05-25T14:09:22,958][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/opt/logstash/modules/netflow/configuration"}
[2018-05-25T14:09:23,055][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"/opt/logstash/data/queue"}
[2018-05-25T14:09:23,059][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.dead_letter_queue", :path=>"/opt/logstash/data/dead_letter_queue"}
[2018-05-25T14:09:23,498][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-05-25T14:09:23,533][INFO ][logstash.agent ] No persistent UUID file found. Generating new UUID {:uuid=>"9de46a0c-dcba-4a3f-a86b-5f9c7f863c0d", :path=>"/opt/logstash/data/uuid"}
[2018-05-25T14:09:24,214][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"6.2.3"}
[2018-05-25T14:09:24,903][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2018-05-25T14:09:25,582][ERROR][logstash.modules.kibanaclient] Error when executing Kibana client request {:error=>#<Manticore::SocketException: Connection refused (Connection refused)>}
[2018-05-25T14:09:25,709][ERROR][logstash.modules.kibanaclient] Error when executing Kibana client request {:error=>#<Manticore::SocketException: Connection refused (Connection refused)>}
[2018-05-25T14:09:25,876][ERROR][logstash.config.sourceloader] Could not fetch all the sources {:exception=>LogStash::ConfigLoadingError, :message=>"Failed to import module configurations to Elasticsearch and/or Kibana. Module: netflow has Elasticsearch hosts: [\"localhost:9200\"] and Kibana hosts: [\"localhost:5601\"]", :backtrace=>["/opt/logstash/logstash-core/lib/logstash/config/modules_common.rb:99:in `block in pipeline_configs'", "org/jruby/RubyArray.java:1734:in `each'", "/opt/logstash/logstash-core/lib/logstash/config/modules_common.rb:56:in `pipeline_configs'", "/opt/logstash/logstash-core/lib/logstash/config/source/modules.rb:16:in `pipeline_configs'", "/opt/logstash/logstash-core/lib/logstash/config/source_loader.rb:59:in `block in fetch'", "org/jruby/RubyArray.java:2481:in `collect'", "/opt/logstash/logstash-core/lib/logstash/config/source_loader.rb:58:in `fetch'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:148:in `converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/opt/logstash/logstash-core/lib/logstash/runner.rb:348:in `block in execute'", "/opt/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
[2018-05-25T14:09:25,888][ERROR][logstash.agent ] An exception happened when converging configuration {:exception=>RuntimeError, :message=>"Could not fetch the configuration, message: Failed to import module configurations to Elasticsearch and/or Kibana. Module: netflow has Elasticsearch hosts: [\"localhost:9200\"] and Kibana hosts: [\"localhost:5601\"]", :backtrace=>["/opt/logstash/logstash-core/lib/logstash/agent.rb:155:in `converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/opt/logstash/logstash-core/lib/logstash/runner.rb:348:in `block in execute'", "/opt/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
The command '/bin/sh -c cd /opt/logstash && bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966' returned a non-zero code: 1
Знаю, что для выполнения `bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966`должна быть запущена kibana и elasticsearch, которые есть в контейнере sebp/elk. Судя по
"Failed to import module configurations to Elasticsearch and/or Kibana. Module: netflow has Elasticsearch hosts: [\"localhost:9200\"] and Kibana hosts: [\"localhost:5601\"]", :backtrace=>["/opt/logstash/logstash-core/lib/logstash/config/modules_common.rb:99:in `block in pipeline_configs'", "org/jruby/RubyArray.java:1734:in `each'", "/opt/logstash/logstash-core/lib/logstash/config/modules_common.rb:56:in `pipeline_configs'", "/opt/logstash/logstash-core/lib/logstash/config/source/modules.rb:16:in `pipeline_configs'", "/opt/logstash/logstash-core/lib/logstash/config/source_loader.rb:59:in `block in fetch'", "org/jruby/RubyArray.java:2481:in `collect'", "/opt/logstash/logstash-core/lib/logstash/config/source_loader.rb:58:in `fetch'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:148:in `converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/opt/logstash/logstash-core/lib/logstash/runner.rb:348:in `block in execute'", "/opt/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
[2018-05-25T14:09:25,888][ERROR][logstash.agent ] An exception happened when converging configuration {:exception=>RuntimeError, :message=>"Could not fetch the configuration, message: Failed to import module configurations to Elasticsearch and/or Kibana. Module: netflow has Elasticsearch hosts: [\"localhost:9200\"] and Kibana hosts: [\"localhost:5601\"]", :backtrace=>["/opt/logstash/logstash-core/lib/logstash/agent.rb:155:in `converge_state_and_update'", "/opt/logstash/logstash-core/lib/logstash/agent.rb:90:in `execute'", "/opt/logstash/logstash-core/lib/logstash/runner.rb:348:in `block in execute'", "/opt/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
The command '/bin/sh -c cd /opt/logstash && bin/logstash --modules netflow --setup -M netflow.var.input.udp.port=9966' returned a non-zero code: 1
Может нюанс в этом?