A funeral procession passed by the Prophet ﷺ, and the people praised the deceased, mentioning his good qualities. The Prophet ﷺ said, "It has become certain."Then another funeral procession passed by him, and the people spoke ill of the deceased, mentioning his bad qualities. He said, "It has become certain. You are Allah's witnesses on earth."
حدثنا أبو بكر بن أبي شيبة حدثنا علي بن مسهر عن محمد بن عمرو عن أبي سلمة
مر على النبي ﷺ بجنازة فأثني عليها خيرا في مناقب الخير فقال وجبت ثم مروا عليه بأخرى فأثني عليها شرا في مناقب الشر فقال وجبت إنكم شهداء الله في الأرض
Its chain of transmission is hasan. Ahmad narrated it, 2/498, 499, and others narrated it as well, from the hadith of Muhammad bin Amr Laythi, through him, and Busiri graded it sahih.