You can set it in Settings>Messages>Keep Messages to delete all messages over 30 days old automatically. Any you wish to save, you can turn iMessage off, then email the message/messages to yourself, then turn iMessage back on.
Sent from my ancient but trustworthy iPhone 5