Hi
As an administrator in an organization, you can view the chat history of members in the organization.
First step to search chat messages on Microsoft Teams is create Content search. You can use Content search eDscovery tool in compliance center of Microsoft 365 admin center to search email, Teams messages, other contents on SharePoint.
1.Go to Microsoft 365 admin center > Compliance

2.On the Compliance center page, select Content search and select New search.
3.In the locations page, set the Status to On for Exchange mailboxes as Microsoft Teams messages are stored here. If you want to search on a specific user’s mailbox, select Choose users, groups, or teams and include specific users, groups or teams.
4.In the Define your search conditions page, you can enter keywords that you want search or you can add other conditions by clicking Add condition.

5.Submit.
6.To view the result of your Content search, go back to Content search page and select your search. If you search status says Completed, that is when the search results are ready to be viewed.
For more details, please refer to this document:
Can System Administrator See Your Chat Messages On Microsoft Teams? – Infra admin's blog (tayam-infra.net)
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
__
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.