Logstash configuration input error with if statement

You cannot use a conditional like that inside an input configuration. See this thread for a way to do this using multiple pipelines.