gpt4 book ai didi

elasticsearch - 麋鹿 : Setup multiple http inputs of logstash ELK stack

转载 作者:行者123 更新时间:2023-11-29 02:51:04 28 4
gpt4 key购买 nike

问题:

  • 如何设置 logstash ELK 堆栈的多个 http 输入

我已经拥有的:

input {
http {
host => "0.0.0.0"
port => "5000"
}
}

output {
elasticsearch {
hosts => "elasticsearch:9200"
}
}
  • 而且我可以使用 URL 上的 postman 轻松发送我的组件日志(作为 JSON):http://localhost:5000

我需要什么:

  • 多个 http 输入,因为我有多个组件 - 类似(但第二个输入不听请求):
input {
http {
host => "0.0.0.0"
port => "5000"
}
http {
host => "0.0.0.0"
port => "7070"
}
}
  • 我必须区分 Kibona 中的那些组件

最佳答案

您可以为每个输入设置一个类型,并使用该类型生成索引名称:

input {
http {
host => "0.0.0.0"
port => "5000"
type => "A"
}

http {
host => "0.0.0.0"
port => "5001"
type => "B"
}
}

使用类型可能就足够了,因为您可以使用它来过滤记录。但是您可能还需要将每种类型的记录存储在不同的索引中,因为每种类型可能对同一字段使用不同的类型。这会导致映射冲突。

output {
elasticsearch {
hosts => "elasticsearch:9200"
index => "%{[type]}-%{+YYYY.MM.dd}"
}
}

关于elasticsearch - 麋鹿 : Setup multiple http inputs of logstash ELK stack,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47218316/

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