Muwatta Malik, Book 16, Hadith 41 (USC-MSA)

Yahya related to me from Malik from Abd ar-Rahman ibn al-Qasim ibn Muhammad ibn Abi Bakr that the Messenger of Allah, may Allah bless him and grant him peace, said, "Let the misfortune that befalls me be a comfort to the Muslims in their misfortunes."

حَدَّثَنِي يَحْيَى، عَنْ مَالِكٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ الْقَاسِمِ بْنِ مُحَمَّدِ بْنِ أَبِي بَكْرٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ لِيُعَزِّ الْمُسْلِمِينَ فِي مَصَائِبِهِمُ الْمُصِيبَةُ بِي ‏" ‏ ‏.‏

sunnah.com

also referenced under: Book 16, Hadith 563 (In-Book)