Flood protection - filters

Is there a way to create a flood protection?

Because we have device sending a lot of messages per hour with the same message again and again.

Is it to possible to have a filter by string or by repetition not to send the message to log file or forward the message but still have at least one copy of the message?