简体   繁体   中英

ELK: Setup multiple http inputs of logstash ELK stack

Question:

  • How to setup multiple http inputs of logstash ELK stack

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):
 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

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:

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

And also

 type => "A" 

Works nice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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