CSF is typically obtained through a procedure called a lumbar puncture or spinal tap, where a needle is inserted into the lower back to collect a sample of fluid. The procedure is usually performed under local anesthesia and is relatively safe, though it can carry some risks, such as infection or bleeding.