The undocumented procedure XP_INSTANCE_REGREAD normally reads exactly one log and searches for entries based on the input parameters:
@lognum: Number of the error log
@logtype: 1 = Server, 2 = Agent
@string1 and @string2: Strings o searchfor in the log
The procedure presented here reads all logs for the search criteria removing the need to try and isolate te offending log entry.
The inital drop table is from SQL Server 2016. If you are using a lesser versio thereplace this with the appropriate IF EXISTS statement.