Dogs have two small glands inside their anus that store a foul-smelling liquid. This fluid is a doggie scent identifier and is released whenever a dog goes to the bathroom. Many dogs never have problems with their anal glands, but the risk of developing an infection or impaction is always present, and when a painful build-up occurs the glands must be manually expressed by a vet, dog groomer or pet owner. Fortunately, your dog will give you pretty clear signals when it's experiencing problems with its anal glands.
Observe your dog's behavior. If he keeps licking or biting the area around his rectum, or if he rubs his butt on and/or drags it along the floor, he's probably experiencing discomfort related to the anal sacs.
Examine your dog's stool. If it is very soft and mushy that may be a sign of impacted anal glands. Inexpensive generic dog foods tend to make the stool soft. When the stool is soft, it will not press hard enough on the anal glands and the fluid will not be released regularly, therefore leading to excessive build-up.
Gently palpate the area surrounding the rectum. Normally, you will not be able to feel the anal sacs under the skin. Inflamed glands, however, will grow from the size of peas to the size of walnuts and you will be able to feel them at the five o'clock and seven o'clock positions.