Sametime comes with a sample logging DLL, this technote explains how to enable logging:
There is also a section in the IBM Redbook
Chapter 5 discusses the chat logging SPI.
IMPORTANT: The stchatlog.dll provided in Sametime 3.0, 3.1, 6.5.1 and 7.0 is only a sample DLL provided in the Sametime API Toolkit. It is intended to be a "proof of concept" to demonstrate that the Sametime API Toolkit can log chats between users. It was never intended to be deployed in an enterprise wide configuration. For deployment purposes, a customer may utilize a third party logging application or develop their own using the Sametime API Toolkit.
There are many 3rd party, tested, enterprise ready solutions out there such as our product IMtegrity ( http://www.imtegrity.com
) that make it easy for users to see their own chats, admins to search, archive etc.