It's most likely anal glad problems.

My cat has that issue, lol, we get him treated at the vet for a good squeezing.

Here is a good article on anal glads in dogs. It has a lot of good information, check it out if you'd like.