"And Moses built an altar and called its name 'the LORD is my banner'" (Exodus 17:15). Rabbi Yehoshua says: Moses called it "my banner" - he said to them: This miracle that the Holy One, blessed be He, performed for you, He performed on my account. Rabbi Elazar of Modi'in says: The Holy One, blessed be He, called it "my banner." For whenever Israel dwells in a state of miracle, it is as though the miracle is before Him; when they dwell in distress, it is as though the distress is before Him; when they dwell in joy, the joy is before Him. And so it says (1 Samuel 2:1): "For I rejoice in Your salvation."
The LORD Is My Banner and God's Share in Israel's Fortunes
Mekhilta DeRabbi Shimon Ben Yochai 17:15
ויבן משה מזבח ויקרא שמו ה' נסי ר' יהושע אומר משה קראו נסי אמר להן נס זה שעשה לכם המקום בגיני עשאו: ר' אלעזר המודעי אומר המקום קראו נסי שכל זמן שישראל שרויין בנס כאלו נס לפניו: שרויין בצרה כאלו צרה היא לפניו: שרויין בשמחה שמחה היא לפניו וכן הוא אומר (ש"א ב' א') כי שמחתי בישועתך: