How to restart a windows program based on repeated errors in it’s log file

how would one approach to automatically restart a windows software on repeated error messages that it writes to a log file in it’s directory?

I looked at numerous software products like wintail, beartail etc. but they all can only “follow” the log file but not act on error messages.

What I’d like to achieve is:
C:examplesoftwarelog.txt

2019-11-08 21:20:43 ERROR Session Timeout to server
2019-11-08 21:20:43 ERROR Session Timeout to server
2019-11-08 21:20:43 ERROR Session Timeout to server

On the third appearance of “Session Timeout to server” I’d like to exit the software and make it start again.

Thanks in advance for any helpful suggestions