This article is from the Canine Medical Information FAQ, by Cindy Tittle Moore with numerous contributions by others.
Blood in the stool can appear in several ways, each indicating a
different problem. Black stools mean bleeding high up in the digestive
tract, most likely a bleeding stomach ulcer. Reddish stools indicate
blood further down the pipe, after the digestive juices have been
neutralized somewhat. This can be anything from ulcers in the small
intestine to ulcerative colitis. Red blotches/streaks on the surface
of the stools (with normal color otherwise) indicate bleeding in the
last segment of the large intestine or rectum, after the stool has
begun to solidify (the function of the large intestine is to
neutralize digestive juices and absorb liquid). This can be ulcerative
colitis (or some other inflammatory bowel disease) or bleeding
hemorrhoids. Each of these problems can be very serious, and in some
cases life-threatening (with the exception of hemorrhoids).
Coloring (natural or artificial) in food can also directly color the
stool so you can't be sure of anything without a chemical analysis. A
sudden diet change/addition can also affect stool color.
Get a sample to the vet.