How to put condition based on certain string in [message]?

The syntax is incorrect. Usually this one is used to check if a string is in an array field like if "_grokparsefailure" in [tags]. In your case you can use regex as in Logstash if statement with regex example