It uses that long ovipositor to probe for beetle grubs in dead trees and when it finds one it lays an egg on the grub. The hatching maggot devours the grub