This is 100% real and everyone experiences it. Academics talk about it as mood congruence; it's a well studied phenomenon in psychology and some work I've done in the past has touched on it. Basically you're more likely to recall past events that match your current mood.
https://en.wikipedia.org/wiki/Mood_congruence