This also depends on how far along you were too. If you were only like 6 weeks pregnant and miscarried, 4 week long bleeding can be a sign that not everything was passed and you would need to see a doctor to make sure nothing is wrong.
After giving birth the bleeding isn't actually a period. It's called lochia and is after birth bleeding. Some women can have this for only a short amount of time, such as 1-2 weeks. Others it can last anywhere from 6-8. After the birth of my daughter I bled for 5 weeks and spotted for another week or so.
Causes for concern would be if you're having large clots or if you're soaking through a pad more than every hour.