Logstash and multiple configurations

Hi
Theoretical question

How does logstash understand which logs to handle ? That is, we have configurations in the postfix folder.conf (for Postfix processing), Nginx (for nginx) they look like this .
input {
beats {
type => "postfix/nginx"
port => 5044
}
}

filter {
if [type] == "postfix/nginx" {
grok {
match => { "message" => "Regxp1/Regexp2"" }
}
}
}
output {
elasticsearch {
type => "postfix/nginx"
hosts => "localhost:9200"
index => "postfix/nginx-%{+YYYY.MM.dd}"

How it will be defined that logs of postfix process Regexp 1, and logs of nginx Regexp2 ?