This is a rare parasitoid wasp in the family Stephanidae found in the rainforests of Peru. The body part sticking up into the air is the abdomen, and the long needle-like structure digging into the wood is not a giant stinger, rather it is actually the egg-laying device known as an 'ovipositor' in insects.
The wasp uses this ovipositor to stab beetle larvae and lay eggs in them, which it does by using its legs to sense beetle vibrations inside the rotten wood it has landed upon. After a few days, the deposited egg hatches and a wasp larva develops inside the beetle larva, eventually killing it and emerging as an adult, which then flies off to stab a beetle larva elsewhere in the rainforest and start the process all over again.
Note: this wasp is a parasitoid because it kills the beetle larva host, opposed to a parasite which just feeds on it but lets it live.