كتاب المساقاة
22  
The Book of Musaqah
(10)
Chapter: The command to kill dogs, and its abrogation. The prohibition of keeping dogs, except for hunting, farming, (herding) livestock and the like
(10)
بَاب الْأَمْرِ بِقَتْلِ الْكِلَابِ وَبَيَانِ نَسْخِهِ وَبَيَانِ تَحْرِيمِ اقْتِنَائِهَا إِلَّا لِصَيْدٍ أَوْ زَرْعٍ أَوْ مَاشِيَةٍ وَنَحْوِ ذَلِكَ
Sahih Muslim 1574 e

Salim reported on the authority of his father (Allah be pleased with him) that Allah's Messenger (ﷺ) said:

He who kept a dog other than one meant for hunting or for the protection of the herd would lose two qirat of his deeds every day. Salim said: Abu Huraira (Allah be pleased with him) used to say: Or the dog meant for watching the field, and he was the owner of the land.
حَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ، أَخْبَرَنَا وَكِيعٌ، حَدَّثَنَا حَنْظَلَةُ بْنُ أَبِي سُفْيَانَ، عَنْ سَالِمٍ، عَنْ أَبِيهِ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ مَنِ اقْتَنَى كَلْبًا إِلاَّ كَلْبَ ضَارٍ أَوْ مَاشِيَةٍ نَقَصَ مِنْ عَمَلِهِ كُلَّ يَوْمٍ قِيرَاطَانِ ‏"‏ ‏.‏ قَالَ سَالِمٌ وَكَانَ أَبُو هُرَيْرَةَ يَقُولُ ‏"‏ أَوْ كَلْبَ حَرْثٍ ‏"‏ ‏.‏ وَكَانَ صَاحِبَ حَرْثٍ ‏.‏
Reference : Sahih Muslim 1574e
In-book reference : Book 22, Hadith 66
USC-MSA web (English) reference : Book 10, Hadith 3819
  (deprecated numbering scheme)