The Messenger of Allah ﷺ said, "Whoever keeps a dog will have two qirats deducted from his reward each day, except for a hunting dog or a dog used to guard livestock."
أخبرنا سويد بن نصر بن سويد قال أنبأنا عبد الله وهو ابن المبارك عن حنظلة قال سمعت سالما يحدث
قال رسول الله ﷺ من اقتنى كلبا نقص من أجره كل يوم قيراطان إلا ضاريا أو صاحب ماشية
Bukhari transmitted it in the Book of Slaughtered Animals and Hunting, chapter: whoever keeps a dog that is not for hunting or herding livestock, hadith no. 5481, and Muslim transmitted it in the Book of Sharecropping, chapter: the command to kill dogs and the explanation of its abrogation, etc., hadith no. 54/1574, from the hadith of Hanzala bin Abu Sufyan with this wording, and it is in Al-Kubra, hadith no. 4795.