It sounds (smells) to me like it could be the dreaded anal glands (cue ominous music). If the smell is only occasionally there, then it could be that your pup just expressed his anal glands -- which produces a very pungent and distinctive odor. If is he scooting on the ground or licking his rear end a lot prior to the smell, then I would definitely suspect anal glands. Some dogs need to have them manually expressed (vet, groomer, or yourself :blink: ) and some dogs express them naturally during the potty process or with a little extra manuvering on their part (scooting/licking).
You may want to do a little research on impacted anal glands and watch your pup for signs of this.
Many people find that adding a little canned pumpkin to their dog's food adds enough fiber to help eliminate the problem of impacted anal glands.
Good luck!