gpt4 book ai didi

elasticsearch - 无法使用logstash将索引从外部文件加载到elasticsearch

转载 作者:行者123 更新时间:2023-12-03 00:26:51 26 4
gpt4 key购买 nike

我在同一台计算机上并行运行一个弹性实例和一个 logstash 实例。

当尝试将文件加载到弹性时,使用正在运行下面的配置文件的logstash,我在弹性上得到以下输出消息并且没有加载文件
(当输入配置为标准输入时,一切似乎都正常)

有任何想法吗?

"
[2014-06-17 22:42:24,748][INFO ][cluster.service ] [Masked Marvel] removed {[logstash- Eitan-PC-5928-2010][Ql5fyvEGQyO96R9NIeP32g][Eitan-PC][inet[Eitan-PC/10.0.0.5:9301]]{client=true, data=false},}, reason: zen-disco-node_failed([logstash-Eitan-PC-5928-2010][Ql5fyvEGQyO96R9NIeP32g][Eitan-PC][inet[Eitan-PC/10.0.0.5:9301]]{client=true, data=false}), reason transport disconnected (wi th 验证连接)
[2014-06-17 22:43:00,686][INFO ][cluster.service ] [Masked Marvel] added {[logstash-Eitan-PC-5292-4014][m0Tg-fcmTHW9aP6zHeUqTA][Eitan-PC][inet[/10.0.0.5:9301]]{client=true, data=false},}, reason: zen-disco-receive(join from node[[logstash-Eitan-PC-5292-4014][m0Tg-fcmTHW9aP6zHeUqTA][Eitan-PC][in et[/10.0.0.5:9301]]{client=true, data=false}])
"

配置文件:

    input { 
file {
path => "c:\testLog.txt"
}
}


output {
elasticsearch { host => localhost
index=> amat1
}

}

最佳答案

当您使用“elasticsearch”作为输出时http://logstash.net/docs/1.4.1/outputs/elasticsearch相对于“elasticsearch_http”http://logstash.net/docs/1.4.1/outputs/elasticsearch_http您将要设置“协议(protocol)”。

原因是它可以有 3 个不同的值,“node”、“http”或“transport”,每个值都有不同的行为,并且默认选择没有很好的记录。

从您的日志文件的外观来看,它似乎正在尝试使用“节点”协议(protocol),因为我看到端口 9301 上的连接尝试表明(以及其他日志条目)logstash 正在尝试作为节点加入集群。这可能由于多种原因而失败,包括集群名称不匹配。

我建议将协议(protocol)设置为“http”——该更改之前已经解决了类似的问题。

也可以看看:

http://logstash.net/docs/1.4.1/outputs/elasticsearch#cluster
http://logstash.net/docs/1.4.1/outputs/elasticsearch#protocol

编辑:

我在您的配置中看到的其他一些问题 -

  • 您的主机和索引应该是字符串,在 logstash 配置中
    文件应该用双引号括起来,“localhost”和“amat1”。
    没有引号可能有效,但他们建议您使用引号。

    http://logstash.net/docs/1.4.1/configuration#string
  • 如果您不使用“http”作为协议(protocol)或不使用
    “elasticsearch_http”作为输出,您应该将集群设置为
    您的 ES 集群名称(因为它将尝试成为
    簇)。
  • 您应该将输入文件下的 start_position 设置为“开始”。
    否则它将默认从文件末尾读取,而您
    不会看到任何数据。这是 Windows 现在的一个特殊问题
    作为在文件中跟踪位置的另一种方式,sincedb,是
    在 Windows 上损坏:

    https://logstash.jira.com/browse/LOGSTASH-1587

    http://logstash.net/docs/1.4.1/inputs/file#start_position
  • 您应该将日志文件的路径更改为:"C:/testLog.txt" . Logstash 更喜欢正斜杠和大写
    Windows 下的驱动器号。

    https://logstash.jira.com/browse/LOGSTASH-430
  • 关于elasticsearch - 无法使用logstash将索引从外部文件加载到elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24272915/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com