Sunan an-Nasa'i, Hadith 4359 ⓘ
It was narrated from al-Hasan: "One of the prophets stopped beneath a tree and an ant bit him, so he gave instructions that their nest be burned with all the ants inside it. Then Allah revealed to him" 'Why did you not punish just one ant?" Al-Ash' ath said: "A similar report was narrated from Ibn Sirin, from Abu Hurairah, from the Prophet, in which were added the words: 'for they glorify Allah."
أَخْبَرَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ، قَالَ أَنْبَأَنَا النَّضْرُ، - وَهُوَ ابْنُ شُمَيْلٍ - قَالَ أَنْبَأَنَا أَشْعَثُ، عَنِ الْحَسَنِ، نَزَلَ نَبِيٌّ مِنَ الأَنْبِيَاءِ تَحْتَ شَجَرَةٍ فَلَدَغَتْهُ نَمْلَةٌ فَأَمَرَ بِبَيْتِهِنَّ فَحُرِّقَ عَلَى مَا فِيهَا فَأَوْحَى اللَّهُ إِلَيْهِ فَهَلاَّ نَمْلَةً وَاحِدَةً . وَقَالَ الأَشْعَثُ عَنِ ابْنِ سِيرِينَ عَنْ أَبِي هُرَيْرَةَ عَنِ النَّبِيِّ صلى الله عليه وسلم مِثْلَهُ وَزَادَ فَإِنَّهُنَّ يُسَبِّحْنَ .
also referenced under: Book 42, Hadith 97 (In-Book) & Volume 5, Book 42, Hadith 4364 (DarusSalam)