The recent observation of an X-ray line at an energy of 3.5 keV mainly from galaxy clusters has initiated a discussion about whether we may have seen a possible dark matter signal. If confirmed, this signal could stem from a decaying sterile neutrino of a mass of 7.1 keV. Such a particle could make up all the dark matter, but it is not clear how it was produced in the early Universe. In this letter we show that it is possible to discriminate between different production mechanisms with present-day astronomical data. The most stringent constraint comes from the Lyman-α forest and seems to disfavor all but one of the main production mechanisms proposed in the literature, which is the production via decay of heavy scalar singlets. Pinning down the production mechanism will help to decide whether the X-ray signal indeed comprises an indirect detection of dark matter.