已解决: logstash docker-compose启动失败,一直报没有权限,包括文件配置路径及端口映射
Logstash | 作者 sun_changlong | 发布于2018年11月06日 | 阅读数:4315logstash目录结构:
├── conf.d
│ └── summary.conf
├── config
│ ├── jvm.options
│ ├── log4j2.properties
│ ├── logstash.yml
│ ├── pipelines.yml
│ └── startup.options
├── docker-compose.yml
├── log
│ └── sys.log
├── logs
│ ├── logstash-plain.log
│ └── logstash-slowlog-plain.log
├── logstash
│ └── maps
└── maps
└── GeoLite2-City-gaode.mmdb
docker-compose.yml
version: '2'
services:
logstash:
image: logstash:6.4.2
container_name: logstash
privileged: true
volumes:
- ./data:/usr/share/logstash/data #:rw
- ./logs:/usr/share/logstash/logs #:rw
- ./log:/usr/share/logstash/log #:rw
- ./conf.d:/etc/logstash/conf.d #:rw
- ./config/logstash.yml:/usr/share/logstash/config/logstash.yml #:rw
- ./config/startup.options:/usr/share/logstash/config/startup.options #:rw
- ./config/log4j2.properties:/usr/share/logstash/config/log4j2.properties #:rw
- ./logstash/maps:/usr/share/logstash/maps #:rw
ports:
- 9600:9600
- 5044:5044
- 515:515/udp
command: "-f /etc/logstash/conf.d -r"
networks:
- lognet
networks:
lognet
docker-compose.yml 中设置了 privileged: true
config下 startup.options 的配置LS_USER 给为root LS_USER=root
运行docker-compose up 以后出现报错,主要是volumes 和 ports 没有权限,部分信息如下:
Creating network "logstash_test_lognet" with the default driver
Creating logstash ... done
Attaching to logstash
logstash | Sending Logstash logs to /usr/share/logstash/logs which is now configured via log4j2.properties
logstash | 2018-11-06 09:47:19,510 main ERROR RollingFileManager (/usr/share/logstash/logs/logstash-plain.log) java.io.FileNotFoundException: /usr/share/logstash/logs/logstash-plain.log ([b]Permission denied[/b]) java.io.FileNotFoundException: /usr/share/logstash/logs/logstash-plain.log (Permission denied)
logstash | at java.io.FileOutputStream.open0(Native Method)
logstash | at java.io.FileOutputStream.open(FileOutputStream.java:270)
logstash | at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
logstash | at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
logstash | at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:640)
logstash | at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)
logstash | at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
logstash | at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:115)
logstash | at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
logstash | at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:144)
logstash | at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:60)
logstash | at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237)
logstash | at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249)
logstash | at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
logstash | at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
logstash | at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(LoggerContext.java:603)
logstash | at org.logstash.log.LoggerExt.reconfigure(LoggerExt.java:158)
logstash | at org.logstash.log.LoggerExt$INVOKER$s$1$0$reconfigure.call(LoggerExt$INVOKER$s$1$0$reconfigure.gen)
logstash | at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:739)
logstash | at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145)
logstash | at usr.share.logstash.logstash_minus_core.lib.logstash.runner.RUBY$method$execute$0(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:257)
logstash | at usr.share.logstash.logstash_minus_core.lib.logstash.runner.RUBY$method$execute$0$__VARARGS__(/usr/share/logstash/logstash-core/lib/logstash/runner.rb)
logstash | at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77)
logstash | at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93)
logstash | at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145)
logstash | at usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.clamp_minus_0_dot_6_dot_5.lib.clamp.command.RUBY$method$run$0(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67)
logstash | at usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.clamp_minus_0_dot_6_dot_5.lib.clamp.command.RUBY$method$run$0$__VARARGS__(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb)
logstash | at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77)
logstash | at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93)
logstash | at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:983)
logstash | at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuperSplatArgs(IRRuntimeHelpers.java:974)
logstash | at org.jruby.ir.targets.InstanceSuperInvokeSite.invoke(InstanceSuperInvokeSite.java:39)
logstash | at usr.share.logstash.logstash_minus_core.lib.logstash.runner.RUBY$method$run$0(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:237)
logstash | at usr.share.logstash.logstash_minus_core.lib.logstash.runner.RUBY$method$run$0$__VARARGS__(/usr/share/logstash/logstash-core/lib/logstash/runner.rb)
logstash | at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77)
logstash | at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93)
logstash | at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145)
logstash | at usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.clamp_minus_0_dot_6_dot_5.lib.clamp.command.RUBY$method$run$0(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132)
logstash | at org.jruby.internal.runtime.methods.CompiledIRMethod.call(CompiledIRMethod.java:77)
logstash | at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:93)
logstash | at org.jruby.ir.targets.InvokeSite.invoke(InvokeSite.java:145)
logstash | at usr.share.logstash.lib.bootstrap.environment.RUBY$script(/usr/share/logstash/lib/bootstrap/environment.rb:73)
logstash | at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
logstash | at org.jruby.ir.Compiler$1.load(Compiler.java:95)
logstash | at org.jruby.Ruby.runScript(Ruby.java:828)
logstash | at org.jruby.Ruby.runNormally(Ruby.java:747)
logstash | at org.jruby.Ruby.runNormally(Ruby.java:765)
logstash | at org.jruby.Ruby.runFromMain(Ruby.java:578)
logstash | at org.logstash.Logstash.run(Logstash.java:102)
logstash | at org.logstash.Logstash.main(Logstash.java:45)
logstash 目录我通过 chmod -R 777 给过权限
0 个回复