An elegy is a poem, song, or other work of art composed as a lament for someone who has died. A eulogy is a speech or written tribute praising someone who had died. Unlike elegy, which is often used figuratively or to describe a work of art with a mournful tone, eulogy is almost exclusively used literally.
Examples
These writers use elegy well:
Occasionally, as with Laura Fraser’s beautiful, clear-eyed recent elegy for her lost lover, somebody hits it out of the park. [Salon.com]
Poetry “makes nothing happen”, said Auden in his elegy for WB Yeats — but he was playing devil’s advocate. [London Evening Standard]
These writers use eulogy well:
A eulogy written by Jobs’s sister, author Mona Simpson, shared that his last words were “Oh wow. Oh wow. Oh wow.” [Washington Post]
Hours after delivering a eulogy at Thurman Munson’s funeral in Ohio, Bobby Murcer drove in all the runs in the Yankees’ dramatic, emotional 5-4 comeback win over the Orioles at Yankee Stadium. [Newsday]
And in these examples, elegy would make more sense than eulogy:
This eulogy to the African ancestors filled the room with music, movement and just the right amount of theatrics, including a spectacular opening sequence of dancers on a backlit stage and a moment which had the audience gasping. [Jamaica Observer]
It is a eulogy to an evocative landscape. [The Mayo News]