Anal sacs, or glands, are located on either side of the anus of dogs in a 4 o’clock and 8 o’clock orientation. They have sweat (apocrine) and oil producing (sebaceous) glands which provide lubrication and release a highly odourous fluid.
It is thought that the function of anal glands is to release odours to mark territory or communicate with other dogs. When new dogs meet each other, they will likely circle each other and sniff the buttocks - it is the gas released by the anal glands that they are picking up on.
The sacs are filled with fluid which is drained when a dog evacuates its bowels. Problems can occur if the sacs do not fully empty on excretion; eventually there will be impaction (faeces remains stuck in the colon) that can become infected and lead to the formation of abscesses.
Anal sac disease is fairly common in dogs and usually resolves on its own, but there are cases where the inflamed glands can cause significant pain to the dog and require professional attention.