grok: Use a if-statement for selecting the correct type of messages

The 'type' tag is deprecated and will be removed in the future.