【问题标题】:Logstash not sending data to elastic search when ran as a service当作为服务运行时,Logstash 不会将数据发送到弹性搜索
【发布时间】: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 日志会显示什么?

标签: elasticsearch logstash


【解决方案1】:

我也遇到了同样的问题... 当我使用 -f 选项执行命令时,它可以正常工作,但是当我启动服务时,什么也没有发生,并且 /etc/log stash 下的日志文件从未更新。

我作为临时对策所做的是执行下面的命令(带 & 选项)

Logstash if conffile.conf &

有了这个,即使我从服务器注销也可以工作。

【讨论】:

    猜你喜欢
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 2019-09-19
    • 1970-01-01
    • 2021-01-20
    • 2022-11-13
    • 1970-01-01
    相关资源
    最近更新 更多