This was first published in an 1885 Lutheran Sunday School book by James R. Murray, but the author of the first two stanzas and the music's composer is unknown. It is certain that stanza 3 was added in 1904 by Dr. John McFarland of New York City.
Some have attributed the song to the Protestant reformer Martin Luther. The confusion may have began because Murray published it with the subtitle "Luther's Cradle Hymn (Composed by Martin Luther for his children and still sung by German mothers to their little ones)."
"Piano Man" was inspired by Billy Joel's time playing at a piano bar in Los Angeles. The "real estate novelist" was a guy who always talked about writing a book, but spent all his spare time in the bar.