4
votes

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
2
You can use the type settings in each of your http inputs to distinguish where the documents came from - Val

2 Answers

9
votes

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}"
  }
}
3
votes

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.