我想激活elasticsearch的日志。
当我运行 elasticsearch 二进制文件时,我意识到我的日志记录有问题:无法加载配置!
这是输出:
~ $ sudo /usr/share/elasticsearch/bin/elasticsearch
Failed to configure logging...
org.elasticsearch.ElasticsearchException: Failed to load logging configuration
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:117)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:81)
at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:97)
at java.nio.file.Files.readAttributes(Files.java:1686)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:109)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:69)
at java.nio.file.Files.walkFileTree(Files.java:2602)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:107)
... 4 more
log4j:WARN No appenders could be found for logger (node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Java HotSpot(TM) Server VM warning: You have loaded library /usr/share/elasticsearch/lib/sigar/libsigar-x86-linux.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
我在 linuxmint 17 下运行并使用最新的 ES。
最佳答案
如果您使用 yum
或 apt-get
等包管理器安装 elasticsearch,则不应以这种方式启动 elasticsearch。尝试使用该服务:例如 /etc/init.d/elasticsearch
或使用命令 sudo service elasticsearch start
您还应该检查 logging.yml 文件是否位于堆栈跟踪中提到的位置:/usr/share/elasticsearch/config
使用 sudo
启动 elasticsearch 不好,您可以使用 sudo elasticsearch
以 elasticsearch 用户身份运行,但我更喜欢使用服务调用,如第二句。
希望有帮助
关于linux - Elasticsearch 无法写入日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24975895/