logStash多数据源配置匹配不同tag

input {
  tcp {
    mode => "server"
    host => "0.0.0.0"
    port => 5044
    codec => "json_lines"
    type=>"test"
  }

  file {
    path => "/mnt/dolphinscheduler/wx_project/comm/utils/log/**/info.log"
        start_position => "beginning"
    type => "info_log"
  }
}
 
input {
  file {
    path => "/mnt/dolphinscheduler/wx_project/comm/utils/log/**/error.log"
        start_position => "beginning"
    type => "error_log"
  }
}
 
filter {
        grok {
        match => {
                "message" => '%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{DATA:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response:int} (?:-|%{NUMBER:bytes:int}) %{QS:referrer} %{QS:agent}'
        }
        }
 
        if[type] == "info_log" {
                mutate {
                        add_tag => ["info_log"]
                }
        }
 
        if [type] == "error_log" {
                mutate {
                        add_tag => ["error_log"]
                }
        } 
        if [type] == "test" {
                mutate {
                        add_tag => ["test"]
                }
        } 

}
 
 
output {
        stdout {
                codec => rubydebug
        }
 
        if "info_log" in [tags] {
                elasticsearch {
                 hosts => ["http://localhost:9200"]
                 index => "info-%{+YYYY.MM.dd}"
          }     
        }
        if "error_log" in [tags] {
                elasticsearch {
                hosts => ["http://localhost:9200"]
                index => "error-%{+YYYY.MM.dd}"
          }     
        }
        if "test" in [tags] {
                elasticsearch {
                hosts => ["http://localhost:9200"]
                index => "test-%{+YYYY.MM.dd}"
          }
        }

        stdout {
          codec => rubydebug
       }

}