Collect logs from multiple machine, what needs to be installed?

Also pls see this chat, Receive multiple Logstash inputs with TCP, UDP and Beats - #3 by sakshat

this person has two logstash config files, but different logstash port number.

So in order to run two different config files, do we need to logstash instance?
Or we can run two config files with same port number?

Will below one work?

input {
	beats {
    port => 5044
    type => 3dlog
  }
}

filter {}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "logs-%{+yyyy.MM.dd}"
  }
}
input {
  tcp {
    port => 5044
    type => syslog
  }
}

filter {
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "app-logs-%{+yyyy.MM.dd}"
  }
}