【发布时间】:2015-07-14 19:34:50
【问题描述】:
这是我存储在 /etc/logstash/conf 中的配置文件
input
{
file{
path => ["PATH_OF_FILE"]
}
}
output
{
elasticsearch
{
host => "172.29.86.35"
index => "new"
}
}
这是我用于网络和 http 的 elasticsearch.yaml 文件内容
\# Set the bind address specifically (IPv4 or IPv6):
\#network.bind_host: 172.29.86.35
\# Set the address other nodes will use to communicate with this node. If not
\# set, it is automatically derived. It must point to an actual IP address.
\#network.publish_host: 192.168.0.1
\# Set both 'bind_host' and 'publish_host':
network.host: 172.29.86.35
\# Set a custom port for the node to node communication (9300 by default):
\#transport.tcp.port: 9300
\# Enable compression for all communication between nodes (disabled by default):
\#transport.tcp.compress: true
\# Set a custom port to listen for HTTP traffic:
\#http.port: 9200
我将 elasticsearch 和 logstash 作为服务运行。问题是当我将 log stash 作为服务启动时,它不会向 elasticsearch 发送任何数据。但是,如果我在 logstash conf 文件中使用相同的配置并从 CLI 运行 logstash,它工作得非常好。甚至日志也没有显示任何错误。
我运行的版本是 1.4.3 的 ES 和 1.4.2 的 LS。 系统环境是 RHEL 7
【问题讨论】:
-
你的“#”前面没有真正的反斜杠,是吗?这可能是一个权限问题,即用户 Logstash 运行时没有读取日志的权限。也许serverfault.com/questions/527706/… 会有所帮助。
-
嗨 Magnus,不,实际上没有反斜杠。 Bdw 我尝试将权限设置为 777,但我遇到了同样的问题。
-
不要让文件世界可写。在任何情况下,日志都不得超过 775。如果您使用
--verbose选项启用详细日志,Logstash 日志会显示什么?