In practice, the duration of thunder from a given lightning bolt might be affected by echos and other phenomena, though you could probably get at least a rough estimate of bolt length by the duration of thunder.
The largest lightning bolts ever measured are hundreds of kilometers long. The longest I'm aware of was over 760 km long (477 mi), measured in February of this year:
<https://www.noaa.gov/stories/worlds-longest-lightning-flash-...>
That probably roared for a while, though attentuation of sound would likely occur within 16--32 km (10--20 mi), or a minute or two. Otherwise, it would take nearly 40 minutes for sound to propagate from one end of the strike to the other.
In reality, these aren't completely instantaneous events. But any event duration at its source is going to decrease the event size. Take the extreme case: the event actually took place at its source over the course of two minutes. And we observed it over two minutes. We would have to conclude that the event had zero size.
Of course, the reality is that we have no idea how long the event took place at its source. All we know is that we observed it over two minutes. But that's enough information to conclude that the event we're seeing certainly occurred within a two light-minute sphere. If it had occurred over a larger sphere, we would have observed it over a longer period of time because of the time light takes to traverse the length of the source.