It is hard to piece together the various contrasting parts in Ecclesiastes, so it is very nice that the author ends with something akin to a moral for the entire book. This main idea, “To fear God and keep His commandments” (Ecclesiastes 12:13), is familiar because it really is the point of all the wisdom literature.
But how does the seeming vanity of much of life point us to the importance of obeying God? Since everything in life apart from God’s pleasure is ultimately fleeting and even incapable of fulfilling our never-ending appetites, we should focus on what truly matters. God judges all, according to the end of Ecclesiastes. Since this is true, let us turn our hearts afresh to God with reverence and a desire to obey Him in all things.