كتاب المساقاة
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 1575 b

Abu Huraira (Allah be pleased with him) reported Allah's Messenger (ﷺ) as saying:

He who kept a dog except one meant for watching the herd, or for hunting or for watching the fields. he lost two qirat of reward every day. Zuhri said: The words of Abu Huraira (Allah be pleased with him) were conveyed to Ibn Umar who said: May Allah have mercy upon Abu Huraira; he owned a field.
حَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ، حَدَّثَنَا عَبْدُ الرَّزَّاقِ، أَخْبَرَنَا مَعْمَرٌ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَنِ اتَّخَذَ كَلْبًا إِلاَّ كَلْبَ مَاشِيَةٍ أَوْ صَيْدٍ أَوْ زَرْعٍ انْتَقَصَ مِنْ أَجْرِهِ كُلَّ يَوْمٍ قِيرَاطٌ ‏"‏ ‏.‏ قَالَ الزُّهْرِيُّ فَذُكِرَ لاِبْنِ عُمَرَ قَوْلُ أَبِي هُرَيْرَةَ فَقَالَ يَرْحَمُ اللَّهُ أَبَا هُرَيْرَةَ كَانَ صَاحِبَ زَرْعٍ ‏.‏
Reference : Sahih Muslim 1575b
In-book reference : Book 22, Hadith 70
USC-MSA web (English) reference : Book 10, Hadith 3823
  (deprecated numbering scheme)