If you want to find multiple occurences of this pattern in a longer text, @mohammedwazeems's solution no longer works.
In that case, use regex:
import re
regex = r".*](.+?)[(]" # avoid all until last ] that is followed by captured anything lazyly
# that is followed by an open (
log_file = """some text that is fine
[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Conversion failed when converting from a character string to uniqueidentifier. (8169) (SQLExecDirectW)
more ok text
[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Fix me error. (8169) (SQLExecDirectW)
more okish text"""
matches = re.finditer(regex, log_file, re.MULTILINE)
for match in matches:
if len(match.groups())>0:
print ( match.group(1))
prints :
Conversion failed when converting from a character string to uniqueidentifier.
Fix me error.
Test it here: https://regex101.com/r/GPWs2a/1