One way to tell where the blood is coming from is how light or dark it looks. Bright red could mean bleeding in your rectum or at the end of your bowel. A dark color could mean something up there, like a stomach ulcer (dark stools due to exposure to stomach acid).
Regardless of the cause, blood in the stool should be checked. A colonoscopy or other tests may be needed to diagnose the problem.