Oil light not working

I’d say it’s not ground where I mounted it to the oil filter adapter. Which is insulated by gaskets.
Use the “T” fitting like mentioned above. Quick and easy and keeps all the wiring in the same place. Not sure how you installed it at the filter adapter. Did you drill/tap it?