We first see the lightsaber in The Clone Wars film and TV show.
The Force Awakens: Visual Dictionary states that Anakin constructed this lightsaber at the start of the Clone Wars:

This lightsaber, Anakin's second lightsaber, is first seen in The Clone Wars CGI film and TV show and in Revenge of the Sith. This is the same lightsaber Obi-Wan gave to Luke and that Rey uses in the sequel trilogy.

Timeline of this lightsaber throughout the Star Wars saga:
Anakin's second lightsaber is first seen in The Clone Wars 2008 CGI film and is subsequently used throughout The Clone Wars CGI TV show.

Anakin continues to use this lightsaber in Revenge of the Sith. Obi-Wan picks up Anakin's lightsaber after facing Anakin/Vader on Mustafar.

Obi-Wan gives the lightsaber to Luke in A New Hope.

Luke lost the lightsaber when his hand was severed on Cloud City in The Empire Strikes Back.

Because "someone salvaged it from the city's industrial depths", we see the lightsaber has ended up in Maz Kanata's possession in The Force Awakens. Finn uses the lightsaber to defend himself on Takodana and Starkiller Base. Rey then confronts Kylo Ren with the lightsaber on Starkiller Base. Rey travels to Ahch-to and offers the lightsaber to Luke Skywalker.

However, in The Last Jedi, Luke tosses the lightsaber off the cliff. Rey retrieves the lightsaber and continues to use it during the film until it is finally severed in two.
