简体   繁体   English

ELK:设置logstash ELK堆栈的多个http输入

[英]ELK: Setup multiple http inputs of logstash ELK stack

Question: 题:

  • How to setup multiple http inputs of logstash ELK stack 如何设置logstash ELK堆栈的多个http输入

What I already have: 我已经拥有的东西:

 input { http { host => "0.0.0.0" port => "5000" } } output { elasticsearch { hosts => "elasticsearch:9200" } } 

What I need: 我需要的:

  • Multiple http inputs because I have multiple Components - something like (but second input does not listen to requests): 多个http输入,因为我有多个组件 - 类似(但第二个输入不监听请求):
 input { http { host => "0.0.0.0" port => "5000" } http { host => "0.0.0.0" port => "7070" } } 
  • I have to distinguish those Components in Kibona 我必须在Kibona中区分这些组件

You can set a type for each input and use that type to generate the index name: 您可以为每个输入设置一个类型,并使用该类型生成索引名称:

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

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

Using the type may suffice, as you can filter the records using it. 使用该类型可能就足够了,因为您可以使用它来过滤记录。 But you may also need to store each type of record in a different index since each type may use a different type for the same field. 但是您可能还需要将每种类型的记录存储在不同的索引中,因为每种类型可能对同一字段使用不同的类型。 This causes a mapping conflict. 这会导致映射冲突。

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

I already resolve this. 我已经解决了这个问题

I needed add a port in my docker-compose.yml file in logstash: section like: 我需要在logstash: section中的docker -compose.yml文件中添加一个端口 ,如:

 ports: - "5000:5000" - "7070:7070" 

And also 并且

 type => "A" 

Works nice. 工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM