2012 Subaru Legacy batteries die every two years

Where do you live? Climate plays a factor in battery life. Since it’s been this consistent, I think it would be worth taking your car into your mechanic to have the charging system checked (starter/alternator/battery) as well as checking for a parasitic draw from your electronics. Have you had anything aftermarket installed?