In practice, the near-bit signals are usually accompanied by noises generated by drilling tool vibration and high-speed rotary. This study introduces discrete wavelet transform to a well drilling area and presents a new weal signal extraction algorithm, which can eliminate the vibration and rotary noises effectively and obtain the useful gravity attitude signals based on the discrete wavelet transform through a hard threshold method. The effectiveness and usefulness of our method are verified via Matlab simulation and actual drilling data.