"To be sure, everything is good, in the sense that it comes from God.
On the other hand, there can be no denying that suffering exists and that the cause of suffering is something that may be called evil.
In this case, the good is hidden, and several levels have to be excavated in order to get to it.
On the simplest level, one can sometimes see it quite directly.
My cow broke a leg, and I found a treasure at that spot.
Or there is the story of Rabbi Akiva who, traveling, could not get lodging at the inn.
He had, however, a candle to read by, a donkey to take him to the forest where he could sleep, and a rooster to wake him in the morning.
So he was pleased and said, “This, too, is for the best.”
Then a lion came and killed his donkey.
A cat devoured his rooster.
And the wind snuffed out his candle.
'This, too, is for the best,' he said, and he curled up in a tree and slept soundly.
In the morning, he learned that a band of wild robbers had come to the inn, looted it, and taken captive all who were there.
Had his donkey neighed or his cock crowed, or had the robbers seen his candle, he, too, would have even plundered.
So that he was able to say again with conviction, 'This, too, is for the best.'"
From Pebbles of Wisdom from Rabbi Adin Steinsaltz collected and with note by Arthur Kurzweil