That was essentially the mem guard of Raspbian to kill java/OH because you have not enough VIRTUAL memory. You can increase that by manually adding swap if you know how to do that.
Swapping however puts the SD card’s integrity at an even larger risk as already does running logging and persistence data.
Did you enable ZRAM ?
But as you say your install is 4yrs old, I would recommend you backup your OH config and install the openHABian RPi image (to a new SD card), activate ZRAM via menu, then restore your OH config. That image is already buster based.
RPi4/4GB. But ZRAM should do to keep your Pi2 (unless it’s too slow as Grafana is a memory hog).