The oil pressure switch or oil pressure sensor in your Subaru communicates with your engine’s computer to turn on the oil light if the oil pressure is low. In some cases, they can fail as a result of an oil leak and must be replaced to prevent catastrophic engine damage.
If it has a Subaru badge it probably fits;
Fits:
2002-2021 Subaru WRX
2004-2014 WRX STI
1990-2023 Legacy
2013-2023 BRZ
2019-2022 Ascent
1998-2013 Forester